mirror of
https://github.com/ankitects/anki.git
synced 2026-10-20 06:29:42 +08:00
## What was happening When I set up the Sonar PoC, I pinned `sonar.projectVersion` to `0.1`. The New Code period is "previous version", so with the version never changing, the baseline stayed frozen at that first analysis. Everything merged since then kept accumulating as "new code" instead of rolling off at each release, which is why the Quality Gate on `main` has been red since August (e.g., coverage for "new code" is at 62%, below the 80% minimum). ## The fix Now the Sonar version follows the project version instead of being pinned, so every release bump gives us a fresh baseline. Pulled from the trusted default-branch checkout so a fork can't tamper with it. ## How it works from now on PRs won't change: Sonar already checks only your diff, so the 80% coverage gate applies just to the lines you touched, not the old debt. For `main`: the baseline now resets on each release. Just note it moves on the next version bump, not on this merge, so `main` stays red until then, and after that "new code" is only what changed since the last release.
31 lines
1.2 KiB
Properties
31 lines
1.2 KiB
Properties
sonar.projectKey=ankitects_anki
|
|
sonar.organization=ankitects
|
|
sonar.host.url=https://sonarcloud.io
|
|
|
|
# sonar.projectVersion is supplied by the workflow from .version. New code is
|
|
# measured since the previous version, so a constant here would freeze the
|
|
# baseline and let every change since it accumulate as new code.
|
|
|
|
# Quality Gate is informative only; keep Sonar out of required checks. A failing
|
|
# gate must not fail the scanner step, so technical failures stay distinguishable.
|
|
sonar.qualitygate.wait=false
|
|
|
|
# Fork code is analyzed as data, never executed. CI already enforces Clippy;
|
|
# scanner-side Clippy/SCA can invoke build tools, so keep them disabled here.
|
|
sonar.rust.clippy.enabled=false
|
|
sonar.sca.enabled=false
|
|
|
|
sonar.sources=pylib/anki,qt/aqt,qt/tools,ts,rslib,tools
|
|
sonar.tests=pylib/tests,qt/tests,tools/tests
|
|
# Test files nested under a source directory must not be indexed as sources.
|
|
sonar.exclusions=out/**,target/**,node_modules/**,**/generated/**,**/*.sql,extra/**,tools/tests/**
|
|
|
|
sonar.python.version=3.10
|
|
sonar.python.coverage.reportPaths=\
|
|
out/coverage/python-pylib/coverage.xml,\
|
|
out/coverage/python-qt/coverage.xml
|
|
|
|
sonar.javascript.lcov.reportPaths=out/coverage/typescript/lcov.info
|
|
|
|
sonar.rust.lcov.reportPaths=out/coverage/rust/lcov.info
|