Added checkstyle for main and test in Gradle configuration

This commit is contained in:
JustFiesta 2024-07-01 13:08:49 +02:00
parent cd8fc79d22
commit 0c5147e3bc

View file

@ -75,17 +75,33 @@ tasks.named('test') {
useJUnitPlatform() useJUnitPlatform()
} }
// Checkstyle configuration - html reports, main classes paths, do not allow http
checkstyle { checkstyle {
configDirectory = project.file('src/checkstyle') configDirectory = project.file('src/checkstyle')
configFile = file('src/checkstyle/nohttp-checkstyle.xml') configFile = file('src/checkstyle/nohttp-checkstyle.xml')
} }
checkstyleMain {
source ='src/main/java'
}
checkstyleTest {
source ='src/test/java'
}
checkstyleNohttp { checkstyleNohttp {
configDirectory = project.file('src/checkstyle') configDirectory = project.file('src/checkstyle')
configFile = file('src/checkstyle/nohttp-checkstyle.xml') configFile = file('src/checkstyle/nohttp-checkstyle.xml')
enabled = true enabled = true
} }
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
html.stylesheet resources.text.fromFile('config/xsl/checkstyle-custom.xsl')
}
}
tasks.named("formatMain").configure { dependsOn("checkstyleMain") } tasks.named("formatMain").configure { dependsOn("checkstyleMain") }
tasks.named("formatMain").configure { dependsOn("checkstyleNohttp") } tasks.named("formatMain").configure { dependsOn("checkstyleNohttp") }
tasks.named("formatTest").configure { dependsOn("checkstyleTest") } tasks.named("formatTest").configure { dependsOn("checkstyleTest") }