Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run checkstyle
# Checkstyle 13+ requires Java 21+.
on: [push, pull_request]
permissions: {}
jobs:
checkstyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
submodules: true
persist-credentials: false
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: zulu
java-version: 24
- run: mvn checkstyle:check -B
57 changes: 19 additions & 38 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@
</execution>
</executions>
</plugin>
<!-- Checkstyle 13+ requires Java 21+. Run manually or via CI. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
<violationSeverity>warning</violationSeverity>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>13.0.0</version>
</dependency>
</dependencies>
</plugin>
Comment on lines +76 to +93

Choose a reason for hiding this comment

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

medium

For improved maintainability, consider managing plugin and dependency versions using properties. Centralizing versions in the <properties> section makes them easier to manage and update across the project. This is a common Maven best practice.

For example, you could add these to your <properties> block:

<properties>
    ...
    <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
    <checkstyle.version>13.0.0</checkstyle.version>
</properties>

Then you can reference them in this plugin definition using ${...}. This approach simplifies version updates and improves consistency, especially when used with the versions-maven-plugin which is already part of this project.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down Expand Up @@ -254,43 +273,5 @@
</plugins>
</build>
</profile>
<!-- Checkstyle 13+ requires Java 21+. -->
<profile>
<id>checkstyle-jdk21</id>
<activation>
<jdk>[21,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
<violationSeverity>warning</violationSeverity>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>13.0.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>checkstyle</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading