Skip to content

Commit 4f798b8

Browse files
Anmol202005rdiachenko
authored andcommitted
Implemented Auto-fix on project source
1 parent 5bece85 commit 4f798b8

File tree

2 files changed

+48
-15
lines changed

2 files changed

+48
-15
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,29 @@ jobs:
1414
runs-on: ${{ matrix.platform }}
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
1818

19-
- name: Setup Maven cache
20-
uses: actions/cache@v4
21-
with:
22-
path: ~/.m2/repository
23-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
24-
restore-keys: |
25-
${{ runner.os }}-maven-
19+
- name: Setup Maven cache
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.m2/repository
23+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
24+
restore-keys: |
25+
${{ runner.os }}-maven-
2626
27-
- name: Set up JDK 11
28-
uses: actions/setup-java@v4
29-
with:
30-
java-version: '11'
31-
distribution: 'corretto'
27+
- name: Set up JDK 11
28+
uses: actions/setup-java@v4
29+
with:
30+
java-version: '11'
31+
distribution: 'corretto'
3232

33-
- name: Build with Maven
34-
run: mvn -e --no-transfer-progress clean install
33+
- name: Build with Maven
34+
run: mvn -e --no-transfer-progress clean install
35+
36+
- name: Check for changes
37+
shell: bash
38+
run: |
39+
git diff --exit-code || (
40+
echo "::error::Code changes detected - run 'mvn clean verify' locally"
41+
exit 1
42+
)

pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222

2323
<rewrite.version>8.54.0</rewrite.version>
24+
<rewrite.maven.plugin>6.11.0</rewrite.maven.plugin>
2425
<recipe.bom.version>3.9.0</recipe.bom.version>
2526
<junit.version>5.13.0</junit.version>
2627
<assertj.version>3.24.2</assertj.version>
@@ -102,7 +103,31 @@
102103
</configuration>
103104
</plugin>
104105

106+
<plugin>
107+
<groupId>org.openrewrite.maven</groupId>
108+
<artifactId>rewrite-maven-plugin</artifactId>
109+
<version>${rewrite.maven.plugin}</version>
110+
<configuration>
111+
<activeRecipes>
112+
<recipe>org.checkstyle.autofix.CheckstyleAutoFix</recipe>
113+
</activeRecipes>
114+
<recipeArtifactCoordinates>
115+
<coordinate>org.checkstyle.autofix:checkstyle-openrewrite-recipes:1.0.0</coordinate>
116+
</recipeArtifactCoordinates>
117+
</configuration>
118+
<executions>
119+
<execution>
120+
<id>checkstyle-autofix</id>
121+
<phase>process-sources</phase>
122+
<goals>
123+
<goal>run</goal>
124+
</goals>
125+
</execution>
126+
</executions>
127+
</plugin>
128+
105129
<!-- Checkstyle plugin for code style regulation -->
130+
106131
<plugin>
107132
<groupId>org.apache.maven.plugins</groupId>
108133
<artifactId>maven-checkstyle-plugin</artifactId>

0 commit comments

Comments
 (0)