Skip to content

Commit 39381e9

Browse files
authored
feat: create check-lint job (#7)
- [x] Должна зависеть от build - [x] Должна запускать mvn checkstyle:check - [x] В корне должен лежать checkstyle.xml
1 parent 61a1969 commit 39381e9

4 files changed

Lines changed: 46 additions & 5 deletions

File tree

‎.github/actions/setup-jdk/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runs:
55
using: "composite"
66
steps:
77
- name: Set up JDK 25
8-
uses: actions/setup-java@v5
8+
uses: actions/setup-java@v6
99
with:
1010
java-version: '25'
1111
distribution: 'temurin'

‎.github/workflows/workflow.yml‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
contents: write
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v7
1717
- name: Set up JDK
1818
uses: ./.github/actions/setup-jdk
1919
- name: Build with Maven
@@ -31,8 +31,20 @@ jobs:
3131
permissions:
3232
contents: read
3333
steps:
34-
- uses: actions/checkout@v5
34+
- uses: actions/checkout@v7
3535
- name: Set up JDK
3636
uses: ./.github/actions/setup-jdk
3737
- name: Check formatting
38-
run: mvn -B spotless:check --file pom.xml
38+
run: mvn -B spotless:check --file pom.xml
39+
40+
lint:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
permissions:
44+
contents: read
45+
steps:
46+
- uses: actions/checkout@v7
47+
- name: Set up JDK
48+
uses: ./.github/actions/setup-jdk
49+
- name: Check lint
50+
run: mvn -B checkstyle:check --file pom.xml

‎checkstyle.xml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="TreeWalker">
7+
<module name="UnusedImports"/>
8+
<module name="RedundantImport"/>
9+
<module name="EqualsHashCode"/>
10+
</module>
11+
</module>

‎pom.xml‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,24 @@
197197
</execution>
198198
</executions>
199199
</plugin>
200+
<plugin>
201+
<groupId>org.apache.maven.plugins</groupId>
202+
<artifactId>maven-checkstyle-plugin</artifactId>
203+
<version>3.6.0</version>
204+
<configuration>
205+
<configLocation>checkstyle.xml</configLocation>
206+
<consoleOutput>true</consoleOutput>
207+
<failOnViolation>true</failOnViolation>
208+
</configuration>
209+
<executions>
210+
<execution>
211+
<phase>verify</phase>
212+
<goals>
213+
<goal>check</goal>
214+
</goals>
215+
</execution>
216+
</executions>
217+
</plugin>
200218
</plugins>
201219
</build>
202-
</project>
220+
</project>

0 commit comments

Comments
 (0)