Repository navigation
chore: enable SonarCloud code quality analysis - #10
Conversation
Enable automated AI code reviews on pull requests with Python-specific review instructions for best practices, type hints, and security. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add SonarCloud project configuration and GitHub Actions workflow to run automated code quality analysis on pushes to main and PRs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
left a comment
There was a problem hiding this comment.
Pull request overview
Adds automated static analysis tooling to the repo via SonarCloud (plus a new CodeRabbit configuration file) to improve continuous code-quality feedback on main pushes and PRs.
Changes:
- Add
sonar-project.propertiesto configure SonarCloud project/org and analysis scope. - Add GitHub Actions workflow to run Sonar analysis on pushes to
mainand PRs targetingmain. - Add
.coderabbit.yamlto enable/configure automated CodeRabbit reviews.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
sonar-project.properties |
Defines SonarCloud project metadata and scan settings. |
.github/workflows/sonarcloud.yml |
Runs Sonar scanning in GitHub Actions for pushes and PRs. |
.coderabbit.yaml |
Enables/configures CodeRabbit automated PR reviews. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove deprecated sonar.language property (auto-detected) - Add sonar.exclusions for _bmad-output/** and .claude/** - Add if-guard to skip SonarCloud scan when token unavailable (fork PRs) - Remove .coderabbit.yaml (belongs in separate PR #11) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves SonarCloud security hotspot: "Use full commit SHA hash for this dependency." Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a SonarCloud analysis CI workflow and project configuration: a GitHub Actions workflow runs SonarCloud scans on pushes and pull requests to Changes
Sequence Diagram(s)sequenceDiagram
actor Developer
participant GitHub as "GitHub Actions (runner)"
participant Repo as "Repository (checkout)"
participant Sonar as "SonarCloud action"
Developer->>GitHub: push or open PR to main
GitHub->>Repo: checkout (fetch-depth: 0)
GitHub->>GitHub: load secrets (SONAR_TOKEN)
alt SONAR_TOKEN present
GitHub->>Sonar: invoke SonarSource/sonarqube-scan-action@v6
Sonar->>Sonar: analyze code (uses sonar-project.properties)
Sonar-->>GitHub: report analysis results
else SONAR_TOKEN missing
GitHub-->>Developer: skip SonarCloud step
end
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
left a comment
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/sonarcloud.yml:
- Around line 1-11: Add an explicit minimal permissions block at the top-level
of the workflow (after the on: block) to avoid relying on repo defaults; for
this SonarCloud job add something like permissions: contents: read,
pull-requests: write, actions: read (or the exact least-privilege set your org
requires) so the sonarcloud job (job name "sonarcloud") only has the necessary
token scopes rather than full default permissions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2fc8073b-984f-4f4c-aa38-cd359a4341c4
📒 Files selected for processing (2)
.github/workflows/sonarcloud.ymlsonar-project.properties
Pins minimal token permissions (contents: read, pull-requests: read) instead of relying on repo/org defaults. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
left a comment
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/sonarcloud.yml:
- Around line 19-22: The step-level env defines SONAR_TOKEN but the step's if:
condition reads env.SONAR_TOKEN before step env is available; move the
SONAR_TOKEN secret up to the job-level env (so env: SONAR_TOKEN: ${{
secrets.SONAR_TOKEN }} is defined on the job) and remove the SONAR_TOKEN entry
from the SonarSource/sonarqube-scan-action step; keep the step's if: condition
as if: env.SONAR_TOKEN != '' and retain the uses:
SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602
reference.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6df6905c-2eaf-4ef7-ada4-23add43b1e9d
📒 Files selected for processing (1)
.github/workflows/sonarcloud.yml
Step-level env is not available during if evaluation. Move secret to job-level env so the step's if condition can properly gate execution on fork PRs where the secret is unavailable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
commented
Mar 26, 2026
|



Summary
Setup required
SONAR_TOKENsecret to the repository settingsTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit