forked from DataDog/dd-trace-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspotbugs.gradle
More file actions
74 lines (68 loc) · 1.97 KB
/
Copy pathspotbugs.gradle
File metadata and controls
74 lines (68 loc) · 1.97 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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
// Can't use the class here due to being different class
tasks.matching { it.name.startsWith('spotbugs') }.configureEach {
// Needs Java 11+ to run spotbugs
it.launcher = javaToolchains.launcherFor {
it.languageVersion = JavaLanguageVersion.current()
}
def name = it.name
if (project.path.startsWith(":dd-smoke-tests")
|| !(name.endsWith("Main")
|| name.endsWith("Main_java11"))
) {
it.enabled = false
return
}
it.showProgress = !providers.environmentVariable("CI").isPresent()
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 = [
'ConstructorThrow',
'DefaultEncodingDetector',
'DoInsideDoPrivileged',
'DontUseEnum',
'DroppedException',
'FindDeadLocalStores',
'FindHEmismatch',
'FindNullDeref',
'FindReturnRef',
'FindRunInvocations',
'FindUselessControlFlow',
'InitializationChain',
'LazyInit',
'LoadOfKnownNullValue',
'LostLoggerDueToWeakReference',
'MethodReturnCheck',
'MutableStaticFields',
'Naming',
'RuntimeExceptionCapture',
'SerializableIdiom',
'UnreadFields',
]
it.reports {
html {
required = true
destination(file("$buildDir/reports/spotbugs/${name}.html"))
stylesheet = 'fancy-hist.xsl'
}
}
}
dependencies {
compileOnly(libs.spotbugs.annotations)
testImplementation(libs.spotbugs.annotations) {
// Exclude conflicting JUnit5.
exclude group: 'org.junit'
exclude group: 'org.junit.jupiter'
exclude group: 'org.junit.platform'
// Exclude conflicting logback.
exclude group: 'ch.qos.logback'
// Exclude conflicting log4j.
exclude group: 'org.apache.logging.log4j'
}
}