Skip to content

Add Sonar config parity checks and CI scan integration - #31

Merged
kgrizz-git merged 2 commits into
mainfrom
chore/sonar-properties-parity
Jul 25, 2026
Merged

kgrizz-git merged 2 commits into
mainfrom
chore/sonar-properties-parity

Conversation

@kgrizz-git

@kgrizz-git kgrizz-git commented Jul 25, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • Added scripts/check_sonar_properties.py to verify the shared Sonar analysis-scope settings stay identical between sonar-project.properties and .sonarcloud.properties.
  • Wired the check into pre-commit and CI so config drift is caught early.
  • Expanded Sonar exclusions to cover more generated/data artifact formats (csv, tsv, xlsx, xls, json, db, sqlite, parquet) in both Sonar config files.
  • Enabled SonarQube Cloud scanning in the main CI workflow with full git history and token-based gating.
  • Added a README quality-gate badge and updated harness docs and changelog to reflect the new Sonar workflow.
  • Added unit tests covering matching, mismatched, and missing shared Sonar properties.

Why

  • The repository now uses both local SonarQube analysis and SonarCloud, so the shared scope settings need to stay in sync.
  • The new parity check prevents silent divergence between the two config files and reduces maintenance risk.
  • The broader exclusions keep generated or data-heavy files out of code-quality analysis, which lowers noise and avoids scanning artifacts that are already handled by other repo controls.

Summary by CodeRabbit

  • Quality & Security

    • Added SonarCloud analysis to main-branch checks when credentials are available.
    • Expanded analysis exclusions to avoid scanning generated, data, image, and document files.
    • Added validation to ensure local and cloud analysis settings remain consistent.
  • Documentation

    • Added a SonarCloud Quality Gate status badge to the README.
    • Updated the changelog and engineering documentation with the enhanced analysis checks.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kgrizz-git, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 20444828-4af9-4cb8-bfc6-8da1360ecfd3

📥 Commits

Reviewing files that changed from the base of the PR and between 241e240 and 7b1571d.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • scripts/check_sonar_properties.py
  • tests/unittests/test_check_sonar_properties.py
📝 Walkthrough

Walkthrough

Sonar exclusion scopes are expanded and checked for parity between local and Cloud configuration. The check runs through pre-commit, pre-push, and CI, while main-branch CI can run a token-gated SonarQube Cloud scan. Documentation and README status visibility are updated.

Changes

Sonar scope integration

Layer / File(s) Summary
Sonar property parity validation
scripts/check_sonar_properties.py, tests/unittests/test_check_sonar_properties.py
Adds parsing and validation for shared Sonar properties, with tests for matching, differing, and missing settings.
Scope configuration and automation
.sonarcloud.properties, sonar-project.properties, .pre-commit-config.yaml, .github/workflows/ci.yml
Expands exclusion patterns, registers the parity check locally and in CI, and adds a token-gated main-branch SonarQube Cloud scan using full git history.
Sonar status and documentation
README.md, CHANGELOG.md, dev-docs/HARNESS_ENGINEERING.md
Adds the SonarCloud quality gate badge and updates changelog and source-of-truth documentation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: Sonar config parity checks plus CI scan integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/sonar-properties-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

231-233: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Disable checkout credential persistence.

The static analysis warning identifies credential persistence on this checkout. No later step needs to push, so add persist-credentials: false to keep the GitHub token out of the repository configuration available to downstream commands and actions.

Proposed fix
       with:
         fetch-depth: 0
+        persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 231 - 233, Update the actions/checkout
step in the CI workflow to set persist-credentials to false alongside
fetch-depth, ensuring checkout credentials are not retained for downstream
commands or actions.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 228: Move SONAR_TOKEN out of the job-level env in cloud-scans-after-gates
and inject it only in the Sonar scan step. Retain a non-secret job-level
availability flag, and use the token-presence output or step condition to gate
the scan without exposing the secret to checkout, installs, tests, Codecov, or
Safety steps.

In `@scripts/check_sonar_properties.py`:
- Around line 18-25: Sanitize diagnostics throughout the property parsing and
validation flow: remove source filenames, paths, raw exception text, and
property keys from messages in the visible parsing logic and the related
exception/reporting branches. Retain only fixed descriptive messages plus safe
context such as line numbers or exception type, while preserving the existing
validation behavior.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 231-233: Update the actions/checkout step in the CI workflow to
set persist-credentials to false alongside fetch-depth, ensuring checkout
credentials are not retained for downstream commands or actions.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aabcb2e3-150b-49fe-a5bd-9bfaa7f700c2

📥 Commits

Reviewing files that changed from the base of the PR and between b5e42f6 and 241e240.

📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • .pre-commit-config.yaml
  • .sonarcloud.properties
  • CHANGELOG.md
  • README.md
  • dev-docs/HARNESS_ENGINEERING.md
  • scripts/check_sonar_properties.py
  • sonar-project.properties
  • tests/unittests/test_check_sonar_properties.py

Comment thread .github/workflows/ci.yml Resolved
Comment thread scripts/check_sonar_properties.py Resolved
@kgrizz-git
kgrizz-git merged commit 6d15437 into main Jul 25, 2026
12 checks passed
@kgrizz-git
kgrizz-git deleted the chore/sonar-properties-parity branch July 25, 2026 21:20
@coderabbitai coderabbitai Bot mentioned this pull request Jul 28, 2026
9 tasks done
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