Bump CodeNarc to 4.0.0 and Docker base image to Java 17 - #51
Bump CodeNarc to 4.0.0 and Docker base image to Java 17#51stefanvacareanu7 wants to merge 1 commit into
Conversation
CodeNarc 4.0.0 drops Groovy 3.x support and requires Java 11+ at runtime, so the packaged JRE is bumped from amazoncorretto 8 to 17 accordingly. Regenerated docs/patterns.json and docs/description/* via DocGenerator, which picked up the new SpockUseVerifyEach rule. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull Request Overview
The PR successfully bumps CodeNarc to version 4.0.0 and upgrades the runtime environment to Java 17. The primary concern is a regression in the 'GrailsStatelessService.md' documentation, which was severely truncated during regeneration, resulting in the loss of the configuration properties table and the introduction of broken Markdown links. Other minor issues include a redundant code example in the 'ComparisonWithSelf' documentation.
Test suggestions
- Verify that the CodeNarc tool version is updated to 4.0.0 in the build configuration.\n- [x] Verify that the Docker base image is updated to Java 17 (Amazon Corretto).\n- [x] Verify that docs/patterns.json version matches the new tool version.\n- [x] Verify that SpockUseVerifyEach is added to patterns.json with enabled set to false.\n- [x] Verify that documentation files are updated with current upstream content.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| transformation. See \[Immutable | ||
| transformation\](https://groovy-lang.org/releasenotes/groovy-1.6.htm |
There was a problem hiding this comment.
🟡 MEDIUM RISK
This documentation file appears to have been accidentally truncated during regeneration. It is missing the configuration properties table (including ignoreFieldNames, addToIgnoreFieldNames, and ignoreFieldTypes) and the 'Known Limitations' section. Additionally, the Markdown link on line 12 is broken due to an escaped opening bracket ('\[') and an incomplete URL (ending in '.htm' instead of '.html'). Please restore the missing content from the previous version while retaining the updated link for the @immutable transformation.
| def c = (x *=* x) { } // violation | ||
| while (x > x) { } // violation | ||
| if (x >= x) { } // violation | ||
| while (x > x) { } // violation |
There was a problem hiding this comment.
⚪ LOW RISK
Nitpick: The 'while (x > x)' violation example is included twice. Remove the redundant instance to keep the documentation concise.
Summary
ThisBuild / toolVersioninbuild.sbtfrom3.6.0to4.0.0(latest CodeNarc release, tagv4.0.0confirmed onCodeNarc/CodeNarc).dockerBaseImagefromamazoncorretto:8-alpine3.21-jretoamazoncorretto:17-alpine3.21. CodeNarc 4.0.0's changelog lists as breaking changes: "Drop support for Groovy 3.x" and "The default CodeNarc artifact ... requires at least Java 11 at runtime" — so the packaged JRE had to move off Java 8. Went with 17 (next LTS after 8) rather than the bare minimum 11, keeping the same Alpine base version (3.21) as before to minimize unrelated diff.docs/patterns.jsonanddocs/description/*viasbt "docGenerator / runMain codacy.codenarc.docs.DocGenerator". The only behavioral diff is the addition of the new SpockUseVerifyEach rule (added upstream in 4.0.0), plus wording/formatting refreshes to existing description files pulled from upstream docs.Note for reviewers (not blocking)
SpockUseVerifyEachappears in CodeNarc'sStarterRuleSet-AllRulesByCategory.groovy.txt(the listDefaultRules.scalais sourced from), alongsideSpockIgnoreRestUsed(enabled) andSpockMissingAssert(already present but not enabled inDefaultRules.listprior to this change). Since the repo already deliberately excludesSpockMissingAssertdespite it being in the starter list, I leftSpockUseVerifyEachdisabled by default too rather than guessing whether Spock rules should now be enabled — flagging this as a product decision if the team wants it enabled out of the box.Validation performed locally
sbt "set scalafmtUseIvy in ThisBuild := false; scalafmt::test; test:scalafmt::test; sbt:scalafmt::test; test"→ all formatting checks and unit tests pass.sbt docker:publishLocal→ image builds successfully on the new base image.codacy-plugins-testagainst the freshly built local image:json→ all tests passedpattern→ all tests passedmultiple→ all tests passed (6 results without config file, 9 with config file, as expected)metricsisn't run for this tool in CI —run_metrics_testsdefaults tofalsein thecodacy/plugins-testorb and isn't enabled in.circleci/config.yml— so it wasn't required, and this repo's fixtures don't have metrics headers anyway.)Test plan
publish_docker_local(scalafmt + test + docker build) passesplugins_test(json/pattern/multiple against the built image) passes