Repository navigation
fix(ci): lower the Sonar baseline to 100 and hold a stale baseline on the next PR, never on main - #307
Open
ffroliva wants to merge 2 commits into
Open
fix(ci): lower the Sonar baseline to 100 and hold a stale baseline on the next PR, never on main#307ffroliva wants to merge 2 commits into
ffroliva wants to merge 2 commits into
Conversation
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…r on main main fails only above sonar-baseline.txt. Every pull request fails while main's open-issue count is below the baseline, so the merge after a fix lowers it and main never turns red when issues are fixed. Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
This was referenced Nov 23, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mainCI has been red since f400538 on the Sonar ratchet step. Issues fixed onmain(103 → 101 → 100) leftsonar-baseline.txthigh, and the ratchet failsmainwhen its open-issue count is below the baseline. The pull request check counted only new issues, so #198, #289 and #298 merged with a green requiredsonarcheck whilemainwas red. SonarCloud gives no reliable pre-merge count of themainissues a pull request fixes, so the merging PR cannot predict the new number.Change
sonar-baseline.txt: 103 → 100, the open count onmain.scripts/ci/sonar_ratchet.py:mainfails only when its count is above the baseline. Below it passes and prints the number to lower to.main's open count and fails while that count is below the PR'ssonar-baseline.txt. The PR after a fixing merge therefore lowers the baseline. The slack never lasts past one merge, and fixing an issue never turnsmainred. A PR may set the baseline belowmain's count ahead of its own fixes.docs/development/ci.mdandskills/release/SKILL.mddescribe the new rule.Sonar-side changes (rule or profile updates, issues accepted in the UI) can still raise
main's count without a commit. That failsmain, as before.Regression tests
mainis below the baselinetest_pull_request_fails_while_main_sits_below_the_baselineassert True is Falsemainredtest_main_below_the_baseline_passes_with_a_warningassert False is Truemain's counttest_a_pull_request_reads_its_own_new_issues_and_mains_open_countRight contains one more item: {'branch': 'main'}Verified:
ruff check,ruff format --check,pyright,pytest -n 2 tests/test_sonar_ratchet.py tests/test_ci_layout.py tests/docs(223 passed), andpython scripts/ci/sonar_ratchet.py --pull-request 306live (no new Sonar issues; the baseline is current).