Conversation
a81038a to
17796cd
Compare
|
@GGraziadei are you happy that this fulfils your request? |
|
Hi @sercuzz8, |
|
Hi @sercuzz8 any updates on this PR? |
|
Hello @GGraziadei, |
129bcfb to
5035de3
Compare
|
Update: I took the need for a rebase as an occasion to improve the implementation. |
|
Hi @sercuzz8 very good progress on this side. Thanks! Migrate from Groovy to OpenRewritePlease proceed according to this table if a OpenRewrite rule is available.
Fix the license noteThe correct license note is this one https://www.apache.org/legal/src-headers.html#headers Trasform this PR in a GitHub actionThe amount of code touched by this PR is too large to review. Could you drop the source fixes from this PR and keep only the tooling, and then add a GitHub Actions workflow (
|
OpenRewrite is preferred: everything it has a recipe for (fully or partly) runs there, driven by a style in rewrite.yml that mirrors storm_checkstyle.xml. The Groovy script only keeps the rules with no recipe (LineLength, OneStatementPerLine, SeparatorWrap, Javadoc rules, member ordering, trivial text rules). A second OpenRewrite execution re-indents after the Groovy stage. A Groovy script normalizes license headers to the ASF template, leaving third-party works alone. Wired into the root and module poms without binding it to validate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…per module Takes the module as input, runs OpenRewrite, the Groovy stage and the re-indent pass plus the license header normalization on it, and pushes the result to checkstyle-fix/<module> so one pull request per module can be opened against master. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
5035de3 to
495ca08
Compare
| distribution: temurin | ||
| java-version: 25 | ||
| - name: Build the module and the modules it depends on (the Groovy stage resolves its classpath) | ||
| run: mvn --batch-mode install -DskipTests -Dcheckstyle.skip=true -pl "$MODULE" -am |
There was a problem hiding this comment.
I advice to execute a checkstyle before and after including the results inside the job artifact of GitHub action.
GGraziadei
left a comment
There was a problem hiding this comment.
Hi @sercuzz8 good progress, thanks!
Some Claude's findings in addition to the inline comments
normalize-license-headers.groovy:74 — greedy # header match deletes non-license comments
fixHash matches the whole leading run of # lines (/\A(?:[ \t]*#[^\n]*(?:\n|\z))+/) and
replaces all of it with the template when it contains the license. Any comment glued to the
header is lost. Concrete cases in the repo: integration-test/config/install-storm.sh loses
# $1 is the storm binary zip file, and integration-test/run-it.sh loses its
# -*- compile-command: ... -*- line. A # -*- coding: -*- line in a Python file would go the
same way. Since the workflow commits and pushes this step automatically, the loss would go
unnoticed. The match should stop at the first blank line or at the end of the license text.
checkstyle-autofix.groovy:762 (illegalTokenText) — \u0020 / \040 turned into a raw space
ESCAPES[32] = ' ' rewrites \u0020 and \040 as a literal space. IllegalTokenText is
configured for TEXT_BLOCK_CONTENT and its format includes 20 / 040. Inside a text block a
trailing \u0020 is the idiomatic way to preserve a trailing space; a raw space is stripped by
text-block processing, so the string value changes. No text blocks exist in Storm today, so this
is latent, but the fixer should skip that escape (or skip text blocks altogether).
checkstyle-autofix.groovy:1305-1315 (splitString) — a split can cut a 3-digit octal escape
Safe cut points advance 2 chars for any non-\u escape, so a 3-digit octal escape such as \123
can be cut into "…\12" + "3…", which changes the string (newline followed by '3' instead of
'S'). There are no octal escapes in Storm sources today, but the scanner should consume up to
three octal digits after the backslash.
.github/workflows/checkstyle-autofix.yaml:51 — modules without the plugins run as silent no-ops
storm-webapp, storm-submit-tools and storm-multilang/python declare
maven-checkstyle-plugin but were not given the two new plugins. Dispatching the workflow for
them passes the "module exists" check, rewrite:run@… and gmavenplus:execute@… run with no
configuration ("no active recipes" / "no scripts"), and the job ends with "Nothing to fix". It
would be better to either add the plugins to those modules or fail the job when the executions
are not configured.
pom.xml:1176 — misleading comment on the gmavenplus pluginManagement
The comment says the fixer "Runs at validate, before the checkstyle", but both executions are bound to <phase>none</phase> (correctly, per the README). Please update the comment so the next maintainer is not misled.
| run: mvn --batch-mode -pl "$MODULE" -Dcheckstyle.skip=true org.codehaus.gmavenplus:gmavenplus-plugin:execute@normalize-license-headers | ||
| - name: Push the result to checkstyle-fix/<module> | ||
| run: | | ||
| BRANCH="checkstyle-fix/$MODULE" |
There was a problem hiding this comment.
This action executes checkout form master. Consider to create a branch for each execution of the action. Once merged the PR it will be deleted.
| git checkout -b "$BRANCH" | ||
| git commit -m "Checkstyle auto-fix of $MODULE" | ||
| git push --force origin "$BRANCH" | ||
| echo "Pushed $BRANCH; open a pull request against master from it." >> "$GITHUB_STEP_SUMMARY" |
There was a problem hiding this comment.
Please execute again the checkstyle reporting the missing warnings, if any.
The GitHub action can create a PR directly.
| * written and the build fails if a file would change. | ||
| */ | ||
|
|
||
| final List<String> TEXT = '''\ |
There was a problem hiding this comment.
The code base currently uses two versions of the ASF header, both accepted by RAT.
The text is identical; they only differ in where the lines wrap.
Could the normalization accept both forms and leave them alone? Rewriting one into
the other touches ~1300 Java files and 40 poms and pollutes git blame on every file
for no legal or functional gain.
After this comment, implement a groovy tool to auto fix checkstyle violation to avoid post hoc fixes