Skip to content

chore: make a Sonar suppression the exception - #311

Merged
ffroliva merged 6 commits into
mainfrom
chore/sonar-suppression-rule
Nov 24, 2026
Merged

ffroliva merged 6 commits into
mainfrom
chore/sonar-suppression-rule

Conversation

@ffroliva

Copy link
Copy Markdown
Owner

Summary

Makes a Sonar suppression the exception rather than a shortcut.

  • AGENTS.md architecture rule 7: an issue is suppressed only when the refactor it asks for would change behaviour, break a contract, or touch a safety path or overhead budget without the evidence those need. The comment states why the refactor was rejected, each pull request that adds one lists it with the refactor that was tried, and issues are never accepted or marked false positive in the SonarCloud UI.
  • tests/test_code_shape.py fails any NOSONAR comment in src/sharpit, tests, scripts or ui/src without the - <reason> form. A planted bare suppression proves the check bites. The 27 suppressions on main all pass it.
  • The pull request template gains a checklist line for new suppressions.

A suppression in the code is still what removes an issue from the count scripts/ci/sonar_ratchet.py reads; this change only governs when one may be written.

Test-Driven Development (Finding -> Test -> Red)

Finding / Requirement Test Node ID Red Assertion Output
A suppression without a reason passes unnoticed tests/test_code_shape.py::test_the_ratchets_catch_a_violation the planted bare.ts line is reported: src/bare.ts:1: NOSONAR needs ' - <reason>'

Contribution Checklist

  • Every non-merge commit carries Signed-off-by.
  • No AI attribution.
  • Changes adhere to AGENTS.md.

…ed reason, listed in the pull request

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
@ffroliva
ffroliva marked this pull request as ready for review November 24, 2026 01:42
@ffroliva
ffroliva merged commit fe3428b into main Nov 24, 2026
50 checks passed
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