Skip to content

Bump CodeNarc to 4.0.0 and Docker base image to Java 17 - #51

Open
stefanvacareanu7 wants to merge 1 commit into
masterfrom
chore/automated-tool-update
Open

Bump CodeNarc to 4.0.0 and Docker base image to Java 17#51
stefanvacareanu7 wants to merge 1 commit into
masterfrom
chore/automated-tool-update

Conversation

@stefanvacareanu7

Copy link
Copy Markdown
Contributor

Summary

  • Bump ThisBuild / toolVersion in build.sbt from 3.6.0 to 4.0.0 (latest CodeNarc release, tag v4.0.0 confirmed on CodeNarc/CodeNarc).
  • Bump dockerBaseImage from amazoncorretto:8-alpine3.21-jre to amazoncorretto: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.
  • Regenerated docs/patterns.json and docs/description/* via sbt "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)

SpockUseVerifyEach appears in CodeNarc's StarterRuleSet-AllRulesByCategory.groovy.txt (the list DefaultRules.scala is sourced from), alongside SpockIgnoreRestUsed (enabled) and SpockMissingAssert (already present but not enabled in DefaultRules.list prior to this change). Since the repo already deliberately excludes SpockMissingAssert despite it being in the starter list, I left SpockUseVerifyEach disabled 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-test against the freshly built local image:
    • json → all tests passed
    • pattern → all tests passed
    • multiple → all tests passed (6 results without config file, 9 with config file, as expected)
    • (metrics isn't run for this tool in CI — run_metrics_tests defaults to false in the codacy/plugins-test orb 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

  • CI: publish_docker_local (scalafmt + test + docker build) passes
  • CI: plugins_test (json/pattern/multiple against the built image) passes

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>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production 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.

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

Comment on lines +11 to +12
transformation. See \[Immutable
transformation\](https://groovy-lang.org/releasenotes/groovy-1.6.htm

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Nitpick: The 'while (x > x)' violation example is included twice. Remove the redundant instance to keep the documentation concise.

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.

2 participants