Skip to content

ci: add qodana analyzer - #1

Merged
RyogiMutsuki merged 1 commit into
mainfrom
feat/qodana
Jun 12, 2026
Merged

ci: add qodana analyzer#1
RyogiMutsuki merged 1 commit into
mainfrom
feat/qodana

Conversation

@RyogiMutsuki

@RyogiMutsuki RyogiMutsuki commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary by Sourcery

CI:

  • Introduce a Qodana GitHub Actions workflow that runs on main, develop, release branches, pushes, and pull requests using qodana.cloud with appropriate permissions.

@github-actions

Copy link
Copy Markdown

Qodana for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Detected 47 dependencies

Third-party software list

This page lists the third-party software dependencies used in QinYuMC

Dependency Version Licenses
Avalonia.Angle.Windows.Natives 2.1.25547.20250602 BSD-3-Clause
Avalonia.BuildServices 11.3.2 MIT
Avalonia.Controls.ColorPicker 11.3.14 MIT
Avalonia.Desktop 11.3.14 MIT
Avalonia.Diagnostics 11.3.14 MIT
Avalonia.Fonts.Inter 11.3.14 MIT
Avalonia.FreeDesktop 11.3.14 MIT
Avalonia.Native 11.3.14 MIT
Avalonia.Remote.Protocol 11.3.14 MIT
Avalonia.Skia 11.3.14 MIT
Avalonia.Themes.Fluent 11.3.14 MIT
Avalonia.Themes.Simple 11.3.14 MIT
Avalonia.Win32 11.3.14 MIT
Avalonia.X11 11.3.14 MIT
Avalonia 11.3.14 MIT
CommunityToolkit.Mvvm 8.4.2 MIT
FlowNet.Core 0.1.4 Apache-2.0
HarfBuzzSharp.NativeAssets.Linux 8.3.1.1 MIT
HarfBuzzSharp.NativeAssets.WebAssembly 8.3.1.1 MIT
HarfBuzzSharp.NativeAssets.Win32 8.3.1.1 MIT
HarfBuzzSharp.NativeAssets.macOS 8.3.1.1 MIT
HarfBuzzSharp 8.3.1.1 MIT
MicroCom.Runtime 0.11.0 MIT
Microsoft.Bcl.AsyncInterfaces 10.0.8 MIT
Microsoft.Extensions.DependencyInjection.Abstractions 10.0.8 MIT
Microsoft.Extensions.DependencyInjection 10.0.8 MIT
Microsoft.NET.ILLink.Tasks 10.0.8 MIT
Microsoft.NETCore.Platforms 1.1.0 MIT
Microsoft.NETFramework.ReferenceAssemblies.net48 1.0.3 MIT
Microsoft.NETFramework.ReferenceAssemblies 1.0.3 MIT
NETStandard.Library 2.0.3 MIT
SkiaSharp.NativeAssets.Linux 2.88.9 MIT
SkiaSharp.NativeAssets.WebAssembly 2.88.9 MIT
SkiaSharp.NativeAssets.Win32 2.88.9 MIT
SkiaSharp.NativeAssets.macOS 2.88.9 MIT
SkiaSharp 2.88.9 MIT
System.Buffers 4.6.1 MIT
System.ComponentModel.Annotations 5.0.0 MIT
System.Diagnostics.DiagnosticSource 8.0.1 MIT
System.IO.Pipelines 8.0.0 MIT
System.Memory 4.6.3 MIT
System.Numerics.Vectors 4.6.1 MIT
System.Runtime.CompilerServices.Unsafe 6.1.2 MIT
System.Security.Cryptography.ProtectedData 10.0.8 MIT
System.Threading.Channels 8.0.0 MIT
System.Threading.Tasks.Extensions 4.6.3 MIT
Tmds.DBus.Protocol 0.21.3 MIT
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@RyogiMutsuki

Copy link
Copy Markdown
Member Author

@sourcery-ai review

@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new GitHub Actions workflow to run JetBrains Qodana static analysis on main, release, and develop branches as well as on pull requests, including checkout of the exact PR commit and configuration for Qodana Cloud integration.

File-Level Changes

Change Details Files
Introduce a Qodana static analysis workflow in GitHub Actions.
  • Create a new GitHub Actions workflow triggered on pushes to main, release branches, develop, and on pull requests and manual dispatch
  • Configure the qodana job to run on ubuntu-latest with write permissions to contents, pull requests, and checks
  • Checkout the pull request head SHA with full history to enable accurate PR analysis
  • Run JetBrains/qodana-action@v2026.1 with PR mode enabled and connect it to Qodana Cloud using QODANA_TOKEN and QODANA_ENDPOINT environment variables
.github/workflows/qodana.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 4 issues, and left some high level feedback:

  • The ref: ${{ github.event.pull_request.head.sha }} in the checkout step will fail for push and workflow_dispatch events where github.event.pull_request is not defined; consider conditioning this step or using github.sha for non-PR triggers.
  • The workflow currently runs on both pull_request and push to main, develop, and releases/*, which may duplicate analysis for the same changes; consider narrowing triggers or differentiating behavior between PR and push events.
  • You might be able to scope down the job permissions (e.g., contents: read instead of write if artifacts or commits are not modified) to follow least-privilege principles while still allowing Qodana to report results.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `ref: ${{ github.event.pull_request.head.sha }}` in the checkout step will fail for `push` and `workflow_dispatch` events where `github.event.pull_request` is not defined; consider conditioning this step or using `github.sha` for non-PR triggers.
- The workflow currently runs on both `pull_request` and `push` to `main`, `develop`, and `releases/*`, which may duplicate analysis for the same changes; consider narrowing triggers or differentiating behavior between PR and push events.
- You might be able to scope down the job permissions (e.g., `contents: read` instead of `write` if artifacts or commits are not modified) to follow least-privilege principles while still allowing Qodana to report results.

## Individual Comments

### Comment 1
<location path=".github/workflows/qodana.yml" line_range="21" />
<code_context>
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}  # to check out the actual pull request commit, not the merge commit
+          fetch-depth: 0  # a full history is required for pull request analysis
+      - name: 'Qodana Scan'
</code_context>
<issue_to_address>
**issue (bug_risk):** Using `github.event.pull_request` will fail on `push` and `workflow_dispatch` events.

This field only exists on `pull_request` events; on `push`/`workflow_dispatch` it’s undefined and the job will fail. Please gate this `ref` assignment behind a condition (e.g., only for `pull_request`), or otherwise use the default `actions/checkout` behavior / branch on `github.event_name` so the workflow works for all triggers.
</issue_to_address>

### Comment 2
<location path=".github/workflows/qodana.yml" line_range="12-17" />
<code_context>
+jobs:
+  qodana:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+      checks: write
+    steps:
+      - uses: actions/checkout@v3
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Permissions look broader than needed and could be tightened.

For a static analysis workflow, `contents: write`, `pull-requests: write`, and `checks: write` are quite elevated. If Qodana only needs to create/update checks and comment on PRs, consider dropping `contents: write` and reducing other scopes to `read` where possible. Minimizing permissions reduces impact if the workflow token is ever misused or compromised.

```suggestion
  qodana:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      checks: write
```
</issue_to_address>

### Comment 3
<location path=".github/workflows/qodana.yml" line_range="19" />
<code_context>
+      pull-requests: write
+      checks: write
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}  # to check out the actual pull request commit, not the merge commit
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider pinning GitHub Actions to a specific commit for better supply-chain security.

Tag references like `@v3` are mutable and can change over time. Please pin this and the `JetBrains/qodana-action` below to specific commit SHAs (with an inline comment noting the tag) to reduce supply-chain risk.

Suggested implementation:

```
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # actions/checkout@v3.6.0

```

```
      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@<PINNED_COMMIT_SHA> # JetBrains/qodana-action@v2026.1

```

To fully implement the supply-chain hardening:

1. Replace `<PINNED_COMMIT_SHA>` with the actual commit SHA corresponding to `JetBrains/qodana-action@v2026.1`.  
   - You can find this by:
     - Visiting https://github.com/JetBrains/qodana-action
     - Checking the commit pointed to by the `v2026.1` tag
     - Copying that full SHA into the workflow.
2. If you later upgrade to a new tag (e.g., `v2026.2`), repeat the process: update the SHA and adjust the inline comment to reflect the new tag.
</issue_to_address>

### Comment 4
<location path=".github/workflows/qodana.yml" line_range="26" />
<code_context>
+      - name: 'Qodana Scan'
+        uses: JetBrains/qodana-action@v2026.1
+        with:
+          pr-mode: true
+        env:
+          QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
</code_context>
<issue_to_address>
**question:** `pr-mode: true` might not be appropriate for non-PR triggers.

Because this workflow also runs on `push` and `workflow_dispatch`, always enabling `pr-mode` may not be ideal for those events. Consider restricting it with `if: github.event_name == 'pull_request'` or separating PR and non-PR runs so each uses the appropriate mode.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using github.event.pull_request will fail on push and workflow_dispatch events.

This field only exists on pull_request events; on push/workflow_dispatch it’s undefined and the job will fail. Please gate this ref assignment behind a condition (e.g., only for pull_request), or otherwise use the default actions/checkout behavior / branch on github.event_name so the workflow works for all triggers.

Comment on lines +12 to +17
qodana:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
checks: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Permissions look broader than needed and could be tightened.

For a static analysis workflow, contents: write, pull-requests: write, and checks: write are quite elevated. If Qodana only needs to create/update checks and comment on PRs, consider dropping contents: write and reducing other scopes to read where possible. Minimizing permissions reduces impact if the workflow token is ever misused or compromised.

Suggested change
qodana:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
checks: write
qodana:
runs-on: ubuntu-latest
permissions:
pull-requests: write
checks: write

pull-requests: write
checks: write
steps:
- uses: actions/checkout@v3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Consider pinning GitHub Actions to a specific commit for better supply-chain security.

Tag references like @v3 are mutable and can change over time. Please pin this and the JetBrains/qodana-action below to specific commit SHAs (with an inline comment noting the tag) to reduce supply-chain risk.

Suggested implementation:

      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # actions/checkout@v3.6.0

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@<PINNED_COMMIT_SHA> # JetBrains/qodana-action@v2026.1

To fully implement the supply-chain hardening:

  1. Replace <PINNED_COMMIT_SHA> with the actual commit SHA corresponding to JetBrains/qodana-action@v2026.1.
  2. If you later upgrade to a new tag (e.g., v2026.2), repeat the process: update the SHA and adjust the inline comment to reflect the new tag.

- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2026.1
with:
pr-mode: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: pr-mode: true might not be appropriate for non-PR triggers.

Because this workflow also runs on push and workflow_dispatch, always enabling pr-mode may not be ideal for those events. Consider restricting it with if: github.event_name == 'pull_request' or separating PR and non-PR runs so each uses the appropriate mode.

@RyogiMutsuki
RyogiMutsuki merged commit afeea02 into main Jun 12, 2026
3 checks passed
@RyogiMutsuki
RyogiMutsuki deleted the feat/qodana branch June 12, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant