Skip to content

chore(quality): drive Sonar findings to zero and close deps backlog#98

Merged
cuioss-oliver merged 5 commits into
mainfrom
feature/plan-13-sonar-residual
Jul 22, 2026
Merged

chore(quality): drive Sonar findings to zero and close deps backlog#98
cuioss-oliver merged 5 commits into
mainfrom
feature/plan-13-sonar-residual

Conversation

@cuioss-oliver

Copy link
Copy Markdown
Collaborator

Summary

Drives the SonarCloud residual backlog to zero for every finding fixable within this branch, closes out the snapshot-deploy publication root-cause investigation, records the Quarkus-version pin rationale (and fixes a stale parent-POM reference in CLAUDE.md), and sweeps every Java license header's copyright year from 2022 to 2026.

Changes

  • Deliverable 1 — snapshot-deploy publication root cause (verification only, zero file change): confirmed the integration-tests and benchmarks modules both suppress publication via skipPublishing — the central-publishing-maven-plugin's own user property — never maven.deploy.skip. The parent POM already sets maven-deploy-plugin skip=true for every module, so maven.deploy.skip was never a candidate switch; skipPublishing is the only correct one.
  • Deliverable 2 — Quarkus pin rationale + stale parent-POM fix (pom.xml, CLAUDE.md): added an in-repo comment next to version.quarkus in pom.xml explaining why the property is a project-owned pin (the resolved de.cuioss:cui-java-parent:1.5.4 chain declares no Quarkus version at all), and corrected CLAUDE.md's stale "cui-java-parent:1.5.1" line to the actual resolved 1.5.4.
  • Deliverable 3 — live SonarCloud backlog query: queried cuioss_API-Sheriff and partitioned the 64 open issues into 34 live (real, code-fixable) and 30 stale ghost findings — all 30 under the deleted pre-rename de.cuioss.sheriff.api.** package tree, each reporting line 0.
  • Deliverable 4 — sweep the 34 live findings to zero: fixed across
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/asset/DirectoryAssetSource.java,
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/asset/PathConfinement.java,
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/asset/UpstreamAssetSource.java,
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/config/model/ResolvedAsset.java,
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/config/validation/ConfigValidator.java,
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/config/load/ConfigLoader.java,
    api-sheriff/src/main/java/de/cuioss/sheriff/gateway/edge/GatewayEdgeRoute.java, and the corresponding test files (e.g. ConfigValidatorTest.java, ConfigModelContractTest.java, TokenValidatorProducerTest.java, DispatchStageTest.java, ThoroughChecksStageTest.java).
  • Deliverable 6 — license-header copyright-year sweep (2022 → 2026): applied across every Java source in api-sheriff, integration-tests, and benchmarks, plus a pom.xml comment recording why the parent's pre-commit profile comment ("no <year> override needed — mycila defaults to the current year") is inaccurate for this project: no <inceptionYear> is declared anywhere in this project or its parent chain, so mycila's ${year} resolution regresses to a stale value (2022) rather than tracking the current year.

Suppressions

Two @SuppressWarnings("java:S6916") (each paired with an in-code // NOSONAR rationale) were added:

  • api-sheriff/src/main/java/de/cuioss/sheriff/gateway/config/model/ResolvedAsset.java:72
  • api-sheriff/src/main/java/de/cuioss/sheriff/gateway/config/validation/ConfigValidator.java:560

Both sites are canonical-constructor / compact bodies whose invariant check switches on an enum constant. S6916 suggests replacing the if inside each case with a when guard, but a when guard can only attach to a pattern label, not an enum-constant label — case DIRECTORY when ... is a compile error (verified against javac --release 25). The suggested remedy is inapplicable at these sites, and restructuring to a type-pattern switch would rewrite the invariant check rather than address the finding.

License-header file-count note

git diff --stat reports 168 Java files changed for the header-year sweep, not the 167 a naive grep -rl count over *.java would suggest. This is a false negative in the grep-based count, not a missed file: one of the 168 files is binary-classified by git's diff machinery (a CRLF/encoding artifact unrelated to header content), so a text-mode grep -l count silently skips it while git diff --stat still reports the change. Verification for this deliverable used license:check — the mycila plugin's own header-compliance verb — rather than a grep count; license:check inspects every file the plugin is configured against regardless of git's binary classification, so it is the stronger, authoritative signal here.

Deferred (blocked on post-merge events — NOT in this PR)

Three of the plan's eight deliverables are deliberately excluded from this PR because each depends on state this PR itself has not yet produced:

Documentation

No doc-tree change was made, and none is warranted: nothing in this PR changes what an operator or contributor does differently. The CLAUDE.md edit is a one-line factual correction (the actual resolved parent-POM version), not a doc-layer description of new behavior; the pom.xml comments are in-code rationale for future maintainers touching that specific property/plugin configuration, not user- or developer-facing documentation. Per the project's three-layer documentation convention, this is stated explicitly rather than silently skipped.

Test Plan

  • verify (full reactor) — passed, confirming the deliverable-1 close-out made no file change
  • verify -Ppre-commit -pl api-sheriff -am — passed with zero errors/warnings after the Sonar sweep (deliverable 4)
  • verify -Ppre-commit — passed with zero errors/warnings after the license-header sweep (deliverable 6)

Generated by plan-finalize skill

Document version.quarkus as a project-owned pin: the resolved parent chain (cui-java-parent 1.5.4 -> cui-java-bom 1.5.4) declares no Quarkus version, so the property overrides nothing and is the single source of truth feeding the quarkus-bom import. Value left unchanged at 3.37.3.

Correct CLAUDE.md parent-POM line from cui-java-parent:1.5.1 to 1.5.4 to match pom.xml line 9.
Re-declare a <year>2026</year> override for com.mycila:license-maven-plugin in the local pre-commit profile. The parent (cui-java-parent 1.5.4) omits <year> on the stated basis that mycila defaults to the current year; that is false (mycila resolves the year from <inceptionYear>, which is absent throughout the chain), so headers pinned to a stale 2022.

Sweep all 168 header-carrying Java sources (107 main, 61 test) from 2022 to 2026 via license:remove followed by license:format under -Ppre-commit. Owner and email remain inherited. Verified with license:check (exit 0) and a repeated quality gate that rewrites nothing.
Production (12 findings): unnamed catch patterns (S7467) in DirectoryAssetSource, PathConfinement, UpstreamAssetSource, ConfigValidator, ConfigLoader and GatewayEdgeRoute; remove the unused private OK constant (S1068); replace a forwarding lambda with a method reference (S1612).

Tests (22 findings): hoist multi-throw lambdas so each assertThrows holds a single invocation (S5778), and collapse near-duplicate tests into parameterized ones (S5976, S1612). Test structure changes only; no assertion was weakened or removed.

Two S6916 findings are suppressed in-code with rationale rather than fixed: the rule proposes a when-guard, but guards attach only to pattern labels, so a guard on an enum constant label is a compile error. ADR-9 and ADR-10 sequencing and error ownership are untouched.
@cuioss-oliver cuioss-oliver added the skip-bot-review Skip AI/bot review for this PR label Jul 22, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @cuioss-oliver, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Excluded labels (none allowed) (1)
  • skip-bot-review

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: Repository: cuioss/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 05cb9f9a-1339-43dc-bb0a-5e4da1a8ac38

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

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.

cuioss-oliver and others added 2 commits July 22, 2026 23:27
The deliverable-4 sweep renamed unused catch parameters to the unnamed
pattern (catch (X e) -> catch (X _)). Each rename touches a line inside a
pre-existing uncovered error path, which drags that already-uncovered line
into SonarCloud's new-code window — taking PR new_coverage to 28.57% (5 of
7 new lines to cover uncovered) and failing the gate on that one condition.

Cover all five rather than reverting the renames, which would reintroduce
the findings the sweep fixed:

- DirectoryAssetSource#realPathWithinRoot IOException path, triggered via an
  in-root symlink to a held descriptor of a deleted file (stats as a regular
  file, but toRealPath() fails) — the TOCTOU-removal case the method must
  fail closed on
- ConfigLoader scalar coercion falling back to TextNode when an all-digit
  substitution overflows Long.parseLong
- ConfigValidator CIDR with a non-numeric prefix length (10.0.0.0/abc)
- ConfigValidator CIDR whose address part is not an IP literal (not-an-ip/24)
- GatewayEdgeRoute#parseMethod rejecting TRACE, a valid HTTP verb absent from
  the gateway's HttpMethod enum

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PpXbDJSEs9wAns2MftaBm7
…ests

The coverage commit itself surfaced two new-code smells:

- java:S7466 in DirectoryAssetSourceTest - use var for the try-with-resources
  unnamed variable instead of naming the type; the InputStream import goes
  with it
- java:S5976 in ConfigValidatorTest - collapse the four malformed-CIDR tests
  into one @ParameterizedTest. Each entry still fails parsing at a different
  point (no slash, out-of-range prefix, non-numeric prefix, non-literal
  address), which the case comment records

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PpXbDJSEs9wAns2MftaBm7
@cuioss-oliver
cuioss-oliver added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 5518e76 Jul 22, 2026
24 checks passed
@cuioss-oliver
cuioss-oliver deleted the feature/plan-13-sonar-residual branch July 22, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-bot-review Skip AI/bot review for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant