-
Notifications
You must be signed in to change notification settings - Fork 791
/
otel.errorprone-conventions.gradle.kts
86 lines (65 loc) · 2.63 KB
/
otel.errorprone-conventions.gradle.kts
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
75
76
77
78
79
80
81
82
83
84
85
86
import net.ltgt.gradle.errorprone.errorprone
plugins {
id("net.ltgt.errorprone")
}
dependencies {
errorprone("com.google.errorprone:error_prone_core")
}
val disableErrorProne = gradle.startParameter.projectProperties.get("disableErrorProne")?.toBoolean()
?: false
tasks {
withType<JavaCompile>().configureEach {
options.errorprone {
isEnabled.set(!disableErrorProne)
disableWarningsInGeneratedCode.set(true)
allDisabledChecksAsWarnings.set(true)
excludedPaths.set(".*/build/generated/.*|.*/concurrentlinkedhashmap/.*")
disable("BooleanParameter")
// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")
// Require Guava
disable("AutoValueImmutableFields")
disable("StringSplitter")
disable("ImmutableMemberCollection")
// Don't currently use this (to indicate a local variable that's mutated) but could
// consider for future.
disable("Var")
// Don't support Android without desugar
disable("AndroidJdkLibsChecker")
disable("Java7ApiChecker")
disable("StaticOrDefaultInterfaceMethod")
// Great check, but for bytecode manipulation it's too common to separate over
// onEnter / onExit
// TODO(anuraaga): Only disable for auto instrumentation project.
disable("MustBeClosedChecker")
// Common to avoid an allocation. Revisit if it's worth opt-in suppressing instead of
// disabling entirely.
disable("MixedMutabilityReturnType")
// We end up using obsolete types if a library we're instrumenting uses them.
disable("JdkObsolete")
disable("JavaUtilDate")
// Limits API possibilities
disable("NoFunctionalReturnType")
// Storing into a variable in onEnter triggers this unfortunately.
// TODO(anuraaga): Only disable for auto instrumentation project.
disable("UnusedVariable")
// TODO(anuraaga): Remove this, we use this pattern in several tests and it will mean
// some moving.
disable("DefaultPackage")
// TODO(anuraaga): Remove this, all our advice classes miss constructors but probably should
// address this.
disable("PrivateConstructorForUtilityClass")
// TODO(anuraaga): Remove this, probably after instrumenter API migration instead of dealing
// with older APIs.
disable("InconsistentOverloads")
disable("TypeParameterNaming")
// We don't use tools that recognize.
disable("InlineMeSuggester")
disable("DoNotCallSuggester")
if (name.contains("Jmh") || name.contains("Test")) {
disable("HashCodeToString")
disable("MemberName")
}
}
}
}