Add Spotless for Code Formatting (#2613)

* style: format from cli

* ci: add style check
This commit is contained in:
Florian BEZANNIER
2025-10-06 10:50:22 +02:00
committed by GitHub
parent 21974fce0e
commit a6d94919e9
2 changed files with 27 additions and 0 deletions

View File

@@ -61,5 +61,12 @@ jobs:
- name: Check file license headers
run: mvn license:check -PcheckLicense --batch-mode
- name: Check code style
run: |
# compare style to target branch
git remote add target ${{ github.event.pull_request.base.repo.clone_url }}
git fetch target
mvn spotless:check -DratchetFrom=${{ github.event.pull_request.base.sha }}
- name: Run tests & javadoc
run: mvn clean verify javadoc:javadoc -DdetectOfflineLinks=false -PgenerateTestReport ${{ inputs.maven_properties }} --batch-mode

20
pom.xml
View File

@@ -130,6 +130,7 @@
<!-- Dash tool integration - END -->
<skipPublishing>false</skipPublishing>
<ratchetFrom>origin/master</ratchetFrom>
</properties>
<developers>
@@ -368,6 +369,25 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<!--
https://github.com/diffplug/spotless/tree/main/plugin-maven#-spotless-keep-your-code-spotless-with-maven
Usage:
mvn spotless:apply
mvn spotless:check
-->
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<ratchetFrom>${ratchetFrom}</ratchetFrom>
<java>
<eclipse>
<file>${maven.multiModuleProjectDirectory}/eclipse_codeformatter.xml</file>
</eclipse>
</java>
</configuration>
</plugin>
</plugins>
<pluginManagement>