Skip to content

build(sonar): scope out the style rules and keep the ones that find defects - #43

Merged
sudoitir merged 3 commits into
mainfrom
claude/sonar-signal-over-noise
Dec 2, 2026
Merged

sudoitir merged 3 commits into
mainfrom
claude/sonar-signal-over-noise

Conversation

@sudoitir

@sudoitir sudoitir commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Sonar listed 532 open issues on main, nearly all code smells that measure size or taste (a variable deliberately named ignored, a constant beside a same-named field in a different case, empty methods in test doubles, cognitive complexity, duplicated literals, "use a record"). Fixing one costs a refactor that defends no behaviour, and the real findings were buried. The few that Sonar typed as bugs turned out to be false positives here.

What changes

  • pom.xml scopes out 27 code-smell rules for the whole repository, grouped by why: size and shape, style the project's conventions contradict, modern-Java suggestions, and test style. Every bug and vulnerability rule and every smell that can hide a defect (dead stores, unused parameters, identical methods, serialisation, mutable statics) stays on.
  • ADR-0042 records the decision and the policy: a pull request is done when its quality gate is green and it adds no issue Sonar types as a bug or vulnerability. The gate ("Sonar way") is unchanged, and Sonar stays advisory in CI.

Verification

  • ./mvnw -N help:evaluate resolves the new properties, so the POM parses and the entries are read.
  • In SonarQube Cloud, the 44 findings on rules that stay on and that I checked by hand were marked false positive with a reason each: assertions in shared check methods (S2699), Files.createTempFile (S5443), Throwable collected from test workers (S1181), interrupts restored by Deadlines.cancelled or ending a thread-owning loop (S2142), constant int products (S2184), a timed tryAcquire (S899), TCK assertions (S5960), the benchmark report's stdout (S106), no-op arms of exhaustive switches (S108), and one exhaustive switch over sealed record types (S1871). The remaining open real findings are 2 serialisation (S1948), 1 regex depth (S5998) and a few small smells.
  • The scoped-out rules' open issues are closed in SonarQube Cloud; the next analysis of main drops them.

🤖 Generated with Claude Code

sudoitir and others added 3 commits December 2, 2026 06:44
…efects

Sonar listed 532 open issues, nearly all code smells that measure size or taste, and the
few that it typed as bugs were false positives. The code-smell rules for size, style,
modern-Java suggestions and test style are scoped out for the whole repository (ADR-0042);
every bug, vulnerability and defect-hiding smell rule stays on, and the quality gate is
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Both can point at a real defect (a swallowed exception, a copy-paste branch), so ADR-0042
keeps them with the other defect-hiding smells.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@sudoitir
sudoitir merged commit 5f81d42 into main Dec 2, 2026
37 of 41 checks passed
@sudoitir
sudoitir deleted the claude/sonar-signal-over-noise branch December 2, 2026 06:30
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