Make maven and gradle share checkstyle configuration

This commit is contained in:
thomasperkins1123 2024-02-14 01:56:03 +00:00 committed by Dave Syer
parent da1c93d367
commit a2f1ad5503
4 changed files with 13 additions and 13 deletions

View file

@ -54,7 +54,13 @@ tasks.named('test') {
} }
checkstyle { checkstyle {
configFile file("${project.rootDir}/src/checkstyle/nohttp-checkstyle.xml") configDirectory = project.file('src/checkstyle')
configFile = file('src/checkstyle/nohttp-checkstyle.xml')
}
checkstyleNohttp {
configDirectory = project.file('src/checkstyle')
configFile = file('src/checkstyle/nohttp-checkstyle.xml')
} }
tasks.named("formatMain").configure { dependsOn("checkstyleMain") } tasks.named("formatMain").configure { dependsOn("checkstyleMain") }

View file

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="node_modules[\\/].*" checks=".*"/>
<suppress files="node[\\/].*" checks=".*"/>
<suppress files="build[\\/].*" checks=".*"/>
<suppress files="target[\\/].*" checks=".*"/>
<suppress files=".+\.(jar|git|ico|p12|gif|jks|jpg|svg|log)" checks="NoHttp"/>
</suppressions>

View file

@ -198,10 +198,12 @@
<phase>validate</phase> <phase>validate</phase>
<configuration> <configuration>
<configLocation>src/checkstyle/nohttp-checkstyle.xml</configLocation> <configLocation>src/checkstyle/nohttp-checkstyle.xml</configLocation>
<suppressionsLocation>src/checkstyle/nohttp-checkstyle-suppressions.xml</suppressionsLocation>
<sourceDirectories>${basedir}</sourceDirectories> <sourceDirectories>${basedir}</sourceDirectories>
<includes>**/*</includes> <includes>**/*</includes>
<excludes>**/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class</excludes> <excludes>**/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class</excludes>
<propertyExpansion>
config_loc=${basedir}/src/checkstyle/
</propertyExpansion>
</configuration> </configuration>
<goals> <goals>
<goal>check</goal> <goal>check</goal>

View file

@ -4,4 +4,7 @@
"https://checkstyle.org/dtds/configuration_1_2.dtd"> "https://checkstyle.org/dtds/configuration_1_2.dtd">
<module name="com.puppycrawl.tools.checkstyle.Checker"> <module name="com.puppycrawl.tools.checkstyle.Checker">
<module name="io.spring.nohttp.checkstyle.check.NoHttpCheck"/> <module name="io.spring.nohttp.checkstyle.check.NoHttpCheck"/>
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/nohttp-checkstyle-suppressions.xml"/>
</module>
</module> </module>