55 * Licensed under the Apache License 2.0
66 */
77
8+ import com.github.spotbugs.snom.Confidence
9+ import com.github.spotbugs.snom.Effort
10+ import com.github.spotbugs.snom.SpotBugsTask
811import net.ltgt.gradle.errorprone.errorprone
912
1013plugins {
1114 id(" java" )
1215 id(" jacoco" )
1316 id(" pmd" )
1417 id(" checkstyle" )
18+ id(" com.github.spotbugs" )
1519 id(" net.ltgt.errorprone" )
1620 id(" com.google.osdetector" )
1721}
@@ -31,6 +35,10 @@ dependencies {
3135
3236 errorprone(" com.google.errorprone:error_prone_core:2.36.0" )
3337 errorprone(" jp.skypencil.errorprone.slf4j:errorprone-slf4j:0.1.28" )
38+
39+ spotbugsPlugins(" jp.skypencil.findbugs.slf4j:bug-pattern:1.5.0" )
40+ spotbugsPlugins(" com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0" )
41+ spotbugsPlugins(" com.mebigfatguy.sb-contrib:sb-contrib:7.6.9" )
3442}
3543
3644java {
5866 ruleSets = listOf ()
5967}
6068
69+ spotbugs {
70+ showProgress.set(true )
71+ effort.set(Effort .MAX )
72+ reportLevel.set(Confidence .LOW )
73+ excludeFilter.set(file(" ${rootDir} /config/spotbugs/exclude.xml" ))
74+ }
75+
76+ tasks.withType<SpotBugsTask >().configureEach {
77+ reports {
78+ create(" xml" ) { enabled = true }
79+ create(" html" ) { enabled = true }
80+ }
81+ }
82+
6183tasks {
6284 withType<JavaCompile >().configureEach {
6385 options.compilerArgs.add(" -parameters" )
@@ -70,7 +92,7 @@ tasks {
7092
7193 test {
7294 useJUnitPlatform()
73- dependsOn(checkstyleMain, checkstyleTest, pmdMain, pmdTest)
95+ dependsOn(checkstyleMain, checkstyleTest, pmdMain, pmdTest, spotbugsMain, spotbugsTest )
7496 finalizedBy(jacocoTestReport, jacocoTestCoverageVerification)
7597 maxParallelForks = 1
7698 }
0 commit comments