Repository navigation
fix(httproutes-generator): report test coverage to Sonar - #216
Merged
alsergs merged 1 commit intoOct 7, 2026
Merged
Conversation
The plugin module has no parent POM and never ran JaCoCo, so Sonar got no coverage report for it and counted every new line as uncovered. Add the prepare-agent and report goals so verify writes target/site/jacoco/jacoco.xml, which the Sonar scanner picks up by default. Also resolve java:S2259 in RouteScanner: hierarchy() checked its argument for null, which made Sonar treat every caller's ClassInfo as nullable. Handle the missing superclass at the call site instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Why
The Sonar quality gate on #212 fails with 0.0% coverage on new code and a C reliability rating. The tests run and pass, but
httproutes-generator-maven-pluginhas no parent POM and never configured JaCoCo. Sonar gets no coverage report for the module and counts all 414 new lines as uncovered.The reliability rating comes from one
java:S2259issue atRouteScanner.java:189.hierarchy()checked its argument for null, so Sonar treated every caller'sClassInfoas nullable. Callers never pass null; onlygetSuperclass()can return it.What
jacoco-maven-plugin0.8.15 (the version other modules use) withprepare-agentand areportexecution inverify. The report lands intarget/site/jacoco/jacoco.xml, the path the Sonar scanner reads by default.RouteScanner.hierarchy(), handle the missing superclass withStream.ofNullable(classInfo.getSuperclass())and drop the null check on the argument.How to verify
mvn verifyincore-maven-plugins/httproutes-generator-maven-pluginwritestarget/site/jacoco/jacoco.xml.java:S2259issue.Base branch is
fix/istio-regex-routes; merge this into #212.🤖 Generated with Claude Code