forked from DataDog/dd-trace-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spotbugs.gradle
57 lines (53 loc) · 1.61 KB
/
spotbugs.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
apply plugin: 'com.github.spotbugs'
spotbugs {
ignoreFailures = true
excludeFilter = file("$rootDir/gradle/spotbugFilters/exclude.xml")
}
// configure spotbugs for Main tasks and disable it for all other
afterEvaluate {
tasks.withType(spotbugsMain.class).configureEach {
def name = it.name
if (name.endsWith("Main") || name.endsWith("Main_java11")) {
it.ignoreFailures = false
// detector documentation is in the following link:
// https://spotbugs-in-kengo-toda.readthedocs.io/en/lqc-list-detectors/detectors.html
it.omitVisitors = [
'DefaultEncodingDetector',
'DoInsideDoPrivileged',
'DontUseEnum',
'DroppedException',
'FindDeadLocalStores',
'FindHEmismatch',
'FindNullDeref',
'FindReturnRef',
'FindRunInvocations',
'FindUselessControlFlow',
'InitializationChain',
'LazyInit',
'LoadOfKnownNullValue',
'LostLoggerDueToWeakReference',
'MethodReturnCheck',
'MutableStaticFields',
'Naming',
'RuntimeExceptionCapture',
'SerializableIdiom',
'UnreadFields',
]
it.reports {
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/${name}.html")
stylesheet = 'fancy-hist.xsl'
}
}
} else {
it.enabled = false
}
}
}
dependencies {
compileOnly 'net.jcip:jcip-annotations:1.0'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.2.0'
testImplementation 'net.jcip:jcip-annotations:1.0'
testImplementation 'com.github.spotbugs:spotbugs-annotations:4.2.0'
}