Skip to content

Commit 3e3243f

Browse files
committed
build: replace Checkstyle with Spotless (google-java-format)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
1 parent c1c9434 commit 3e3243f

1 file changed

Lines changed: 91 additions & 21 deletions

File tree

‎pom.xml‎

Lines changed: 91 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@
7979
<logback.version>1.6.3</logback.version>
8080
<version.testcontainers>2.0.5</version.testcontainers>
8181
<error-prone.version>2.50.0</error-prone.version>
82+
<spotless-maven-plugin.version>3.10.4</spotless-maven-plugin.version>
83+
<google-java-format.version>1.37.0</google-java-format.version>
8284
<nullaway.version>0.14.1</nullaway.version>
8385
<error-prone.flag>-XDaddTypeAnnotationsToSymbol=true</error-prone.flag>
8486
<nullaway.args>-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -Xep:RequireExplicitNullMarking:WARN -XepOpt:NullAway:ExhaustiveOverride=true -XepOpt:NullAway:OnlyNullMarked=true -XepOpt:NullAway:JSpecifyMode=true -XepExcludedPaths:.*/src/test/.* -XepDisableWarningsInGeneratedCode</nullaway.args>
87+
<skip.spotless>true</skip.spotless>
8588

8689
<!-- Redirect test output to file -->
8790
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
@@ -588,6 +591,11 @@
588591
</execution>
589592
</executions>
590593
</plugin>
594+
<plugin>
595+
<groupId>com.diffplug.spotless</groupId>
596+
<artifactId>spotless-maven-plugin</artifactId>
597+
<version>${spotless-maven-plugin.version}</version>
598+
</plugin>
591599
</plugins>
592600
</pluginManagement>
593601
<plugins>
@@ -604,32 +612,94 @@
604612
<artifactId>central-publishing-maven-plugin</artifactId>
605613
</plugin>
606614
<plugin>
607-
<groupId>org.apache.maven.plugins</groupId>
608-
<artifactId>maven-checkstyle-plugin</artifactId>
609-
<version>${maven-checkstyle-plugin.version}</version>
610-
<dependencies>
611-
<dependency>
612-
<groupId>com.puppycrawl.tools</groupId>
613-
<artifactId>checkstyle</artifactId>
614-
<version>${checkstyle.version}</version>
615-
</dependency>
616-
</dependencies>
615+
<groupId>com.diffplug.spotless</groupId>
616+
<artifactId>spotless-maven-plugin</artifactId>
617+
<configuration>
618+
<skip>${skip.spotless}</skip>
619+
<formats>
620+
<!-- you can define as many formats as you want, each is independent -->
621+
<format>
622+
<!-- define the files to apply to -->
623+
<includes>
624+
<include>.gitignore</include>
625+
</includes>
626+
<!-- define the steps to apply to those files -->
627+
<trimTrailingWhitespace/>
628+
<endWithNewline/>
629+
<indent>
630+
<spaces>true</spaces>
631+
<spacesPerTab>4</spacesPerTab>
632+
</indent>
633+
</format>
634+
</formats>
635+
<!-- define a language-specific format -->
636+
<java>
637+
<includes>
638+
<include>**/src/main/java/**/*.java</include>
639+
<include>**/src/test/java/**/*.java</include>
640+
</includes>
641+
<googleJavaFormat>
642+
<version>1.36.1</version>
643+
<style>AOSP</style>
644+
<reflowLongStrings>true</reflowLongStrings>
645+
<formatJavadoc>false</formatJavadoc>
646+
</googleJavaFormat>
647+
<importOrder/>
648+
<shortenFullyQualifiedTypes/>
649+
<importOrder/>
650+
<removeUnusedImports/>
651+
<indent>
652+
<spaces>true</spaces>
653+
<spacesPerTab>4</spacesPerTab>
654+
</indent>
655+
</java>
656+
<pom>
657+
<includes>
658+
<include>pom.xml</include>
659+
<include>**/pom.xml</include>
660+
</includes>
661+
<sortPom>
662+
<encoding>UTF-8</encoding>
663+
<expandEmptyElements>false</expandEmptyElements>
664+
<spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
665+
<keepBlankLines>true</keepBlankLines>
666+
<nrOfIndentSpace>4</nrOfIndentSpace>
667+
<indentBlankLines>false</indentBlankLines>
668+
<indentSchemaLocation>false</indentSchemaLocation>
669+
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
670+
<sortPlugins>groupId,artifactId</sortPlugins>
671+
<sortProperties>true</sortProperties>
672+
<sortModules>false</sortModules>
673+
<sortExecutions>false</sortExecutions>
674+
</sortPom>
675+
</pom>
676+
<markdown>
677+
<includes>
678+
<!-- You have to set the target manually -->
679+
<include>docs/**/*.md</include>
680+
<include>CODE_OF_CONDUCT.md</include>
681+
<include>CONTRIBUTING.md</include>
682+
<include>CONTRIBUTING_INTEGRATIONS.md</include>
683+
<include>README.md</include>
684+
<include>RELEASE.md</include>
685+
<include>SECURITY.md</include>
686+
</includes>
687+
<flexmark>
688+
<emulationProfile>COMMONMARK</emulationProfile>
689+
<pegdownExtensions>ALL,TOC</pegdownExtensions>
690+
<extensions>YamlFrontMatter,Emoji</extensions>
691+
<formatterOptions>
692+
<rightMargin>120</rightMargin>
693+
</formatterOptions>
694+
</flexmark>
695+
</markdown>
696+
</configuration>
617697
<executions>
618698
<execution>
619-
<id>checkstyle-validation</id>
620-
<phase>validate</phase>
621-
<inherited>true</inherited>
622-
<configuration>
623-
<skip>false</skip>
624-
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
625-
<includeTestSourceDirectory>true</includeTestSourceDirectory>
626-
<consoleOutput>true</consoleOutput>
627-
<failsOnError>false</failsOnError>
628-
<failOnViolation>${checkstyle.failOnViolation}</failOnViolation>
629-
</configuration>
630699
<goals>
631700
<goal>check</goal>
632701
</goals>
702+
<phase>compile</phase>
633703
</execution>
634704
</executions>
635705
</plugin>

0 commit comments

Comments
 (0)