Skip to content

Commit

Permalink
Add checkstyle for gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPerkins1123 committed Feb 9, 2024
1 parent 6fe21e5 commit 7c41420
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ plugins {
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'io.spring.javaformat' version '0.0.40'
id 'io.spring.javaformat' version '0.0.41'
id "io.spring.nohttp" version "0.0.11"
}

apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'io.spring.javaformat'

gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ]
Expand Down Expand Up @@ -43,8 +45,29 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-docker-compose'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'
checkstyle 'io.spring.javaformat:spring-javaformat-checkstyle:0.0.41'
checkstyle 'com.puppycrawl.tools:checkstyle:10.12.5'
}

tasks.named('test') {
useJUnitPlatform()
}

checkstyle {
configFile file("${project.rootDir}/src/checkstyle/nohttp-checkstyle.xml")
}

tasks.named("formatMain").configure { dependsOn("checkstyleMain") }
tasks.named("formatMain").configure { dependsOn("checkstyleNohttp") }

tasks.named("formatTest").configure { dependsOn("checkstyleTest") }
tasks.named("formatTest").configure { dependsOn("checkstyleNohttp") }

checkstyleAot.enabled = false
checkstyleAotTest.enabled = false

checkFormatAot.enabled = false
checkFormatAotTest.enabled = false

formatAot.enabled = false
formatAotTest.enabled = false
11 changes: 11 additions & 0 deletions config/nohttp/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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>
1 change: 1 addition & 0 deletions src/checkstyle/nohttp-checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<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>

0 comments on commit 7c41420

Please sign in to comment.