Skip to content

chore(ci): replace SonarCloud with ruff + Codecov - #1710

Merged
MuncleUscles merged 4 commits into
v0.123-devfrom
chore/remove-sonarcloud
Jul 23, 2026
Merged

chore(ci): replace SonarCloud with ruff + Codecov#1710
MuncleUscles merged 4 commits into
v0.123-devfrom
chore/remove-sonarcloud

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Two commits — the second is independent and can be dropped if you disagree with it.

Why remove it

The gate measured the wrong diff. main is the only branch SonarCloud has ever branch-analysed (last analysis 2026-06-17), so PRs targeting dev branches had no baseline and were scored against a stale main. "New code" meant the entire dev-branch-vs-main divergence, not the PR.

Proof — #1707 and #1708 are the same fix (identical title, +8/−4, same two files), differing only in base branch:

PR Base Sonar "new lines" Coverage Gate
#1707 v0.121 2,461 85.24% pass
#1708 v0.123-dev 13,813 77.21% fail

#1706's report listed fees.py (3,531 lines) and consensus/base.py (782) — files it never touched.

It never gated anything. Not a required check in any ruleset. 9 of the last 60 merged PRs merged with it red — 9 out of 9. It also silently didn't run at all on 16 PRs in May.

Nobody owned it. 0 of 65 security hotspots reviewed, ever. 791 open issues. The gate on main itself has been red indefinitely. Seven commits exist purely to appease it (bundling params into a dataclass for S107, # NOSONAR on RFC1918 constants, three separate exclusion commits) against no verified defect it caused to be fixed.

A red check that is wrong on every dev-branch PR trains everyone to ignore red checks — including E2E and CodeQL, which are load-bearing.

What covers the gap

  • Security: CodeQL (python + javascript, dataflow/taint) and Semgrep (--config auto, daily, SARIF) both already run. Sonar's security rules were the shallowest of the three, and contributed 2 BLOCKER-severity false positives from a stale FastAPI stub.
  • Coverage: the second commit sends backend coverage.xml to Codecov. It had exactly one consumer — Sonar — so removing Sonar alone would have taken backend coverage dark. Codecov scores the real PR diff, which is precisely what the old gate got wrong.

Not lost

Removing the CI integration stops new scans; it does not delete the SonarCloud project, so the existing 791 issues and 65 hotspots stay readable at sonarcloud.io for a one-off harvest. A sample found a few genuine bugs worth rescuing before the project is eventually deleted — notably two bare asyncio.create_task() calls with no retained reference (redis_worker_handler.py:185, worker_handler.py:117), where the task can be GC'd mid-flight and silently drop a publish.

Follow-ups (not in this PR)

  • ruff in pre-commit + CI — verified locally to catch RUF006 on both create_task sites, i.e. the one category where Sonar produced real value. Backend Python linting is currently just black + autoflake.
  • scan-codeql.yml triggers on opened, ready_for_review, reopened but not synchronize, so CodeQL does not rescan when commits are pushed to an open PR.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 98f55b70-c8d0-4843-887f-b860895654d6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-sonarcloud

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.

@MuncleUscles MuncleUscles changed the title chore(ci): remove SonarCloud chore(ci): replace SonarCloud with ruff + Codecov Jul 23, 2026
The quality gate measured the wrong diff. Dev branches were never
branch-analysed, so PRs against them were scored against a stale main:
the same 8-line fix passed on one base and failed on another. It was
never a required check, and 9 of the last 60 merged PRs merged red.
CodeQL and Semgrep already cover the security rules.
Backend coverage.xml had exactly one consumer, and removing SonarCloud
left it unread. Codecov scores the real PR diff instead of a stale
branch baseline, which is what the old gate got wrong.
Without synchronize, CodeQL only ran when a PR opened or reopened, so the first commit's result kept showing while later commits went unscanned.
Backend linting was black and autoflake only. Ruff catches three asyncio tasks created without a retained reference, which the event loop can garbage-collect mid-flight so a log publish silently never happens.
@MuncleUscles
MuncleUscles force-pushed the chore/remove-sonarcloud branch from c79bb78 to 4747278 Compare July 23, 2026 17:01
@MuncleUscles
MuncleUscles merged commit d7272a9 into v0.123-dev Jul 23, 2026
25 of 26 checks passed
@MuncleUscles
MuncleUscles deleted the chore/remove-sonarcloud branch July 23, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant