Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/checkstyle-autofix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Runs the checkstyle auto-fix (storm-checkstyle/README.md) on one module and pushes the result to
# the branch checkstyle-fix/<module>, from which a pull request against master can be opened.
name: Checkstyle auto-fix

on:
workflow_dispatch:
inputs:
module:
description: 'Maven module to fix, as its path in the repository (e.g. storm-client or external/storm-hdfs)'
required: true
type: string

permissions:
contents: write

jobs:
autofix:
runs-on: ubuntu-latest
timeout-minutes: 120
env:
MODULE: ${{ inputs.module }}
steps:
- name: Validate the module input
run: |
if ! [[ "$MODULE" =~ ^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*$ ]] || [[ "$MODULE" == *..* ]]; then
echo "::error::'$MODULE' is not a valid module path"
exit 1
fi
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check that the module exists
run: test -f "$MODULE/pom.xml" || { echo "::error::$MODULE/pom.xml not found"; exit 1; }
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 25
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I advice to execute a checkstyle before and after including the results inside the job artifact of GitHub action.

- name: Auto-fix the module (OpenRewrite, Groovy, OpenRewrite re-indent)
run: |
mvn --batch-mode -pl "$MODULE" -Dcheckstyle.skip=true \
org.openrewrite.maven:rewrite-maven-plugin:run@checkstyle-autofix-openrewrite \
org.codehaus.gmavenplus:gmavenplus-plugin:execute@checkstyle-autofix \
org.openrewrite.maven:rewrite-maven-plugin:run@checkstyle-reindent-openrewrite
- name: Normalize the license headers
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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

# only the module itself (build output is git-ignored), never the tooling files
git add -A -- "$MODULE"
if git diff --cached --quiet; then
echo "Nothing to fix in $MODULE"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please execute again the checkstyle reporting the missing warnings, if any.
The GitHub action can create a PR directly.

Empty file added .mvn/.gitkeep
Empty file.
11 changes: 11 additions & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
10 changes: 10 additions & 0 deletions examples/storm-hdfs-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-jdbc-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-jms-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@
</executions>

</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-kafka-client-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-loadgen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-perf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@
<mainClass>${storm.topology}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-redis-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions examples/storm-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@
<excludedGroups>none</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-autocreds/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-blobstore-migration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ limitations under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-hdfs-blobstore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-hdfs-oci/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-hdfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@
<forkCount>1</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-jms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-kafka-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions external/storm-kafka-migration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@

<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<!--Note - the version/config would be inherited-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
Loading
Loading