Repository navigation
Fix the indentation the checkstyle auto-fix gets wrong - #9178
Merged
Merged
Conversation
OpenRewrite's TabsAndIndents re-indent pass puts array initializer elements at the continuation indent and misplaces the bodies of some anonymous classes and enum constants, which Checkstyle's Indentation check rejects (27 errors on storm-client). Replace that pass with the checkstyle-autofix-indentation execution, which runs the Groovy stage again with only new Indentation and CommentsIndentation fixers. They move each reported line (and the rest of a reported declaration header, or a whole block comment) to the level Checkstyle's message expects. The auto-fix still runs three passes. 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.
OpenRewrite's
TabsAndIndentsre-indent pass puts array initializer elements at thecontinuation indent and misplaces the bodies of some anonymous classes and enum constants.
Checkstyle's
Indentationcheck rejects these as errors, so the auto-fix ofstorm-client(run on my fork) went from 0 to 27 errors and failed
mvn validate.The other warnings stayed the same or decreased, depending on their category.
Changes
checkstyle-reindent-openrewrite) with a Groovypass (
checkstyle-autofix-indentation) that runscheckstyle-autofix.groovywith only newIndentationandCommentsIndentationfixers. These move each reported line (plus the restof a reported declaration header, or a whole block comment) to the level Checkstyle expects.
rewrite.ymlandstorm-checkstyle/README.mdto match.The auto-fix still runs three passes.
Testing
Tested locally on
storm-client, starting from a copy that has not been auto-fixed:Indentationmvn validate -pl storm-clientWarnings per check, before the run (
master) and after it (this PR's tooling):(
diff -r -w -Bis empty).compiling or running tests.
To reproduce:
Known leftover
The closing
},of theSUPERVISORenum constant inDaemonType.javastays at column 0.Checkstyle doesn't flag it.
🤖 Generated with Claude Code, revised by humans