-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathai.errorprone-conventions.gradle.kts
More file actions
89 lines (65 loc) · 2.85 KB
/
ai.errorprone-conventions.gradle.kts
File metadata and controls
89 lines (65 loc) · 2.85 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import net.ltgt.gradle.errorprone.errorprone
plugins {
id("net.ltgt.errorprone")
}
dependencies {
errorprone("com.google.errorprone:error_prone_core")
}
val disableErrorProne = properties["disableErrorProne"]?.toString()?.toBoolean() ?: false
tasks {
withType<JavaCompile>().configureEach {
with(options) {
// Error Prone 2.45.0+ requires this flag when running on JDK 21
// See: https://github.com/google/error-prone/releases/tag/v2.45.0
compilerArgs.add("-XDaddTypeAnnotationsToSymbol=true")
errorprone {
if (disableErrorProne) {
logger.warn("Errorprone has been disabled. Build may not result in a valid PR build.")
isEnabled.set(false)
}
disableWarningsInGeneratedCode.set(true)
allDisabledChecksAsWarnings.set(true)
// Ignore warnings for generated classes
excludedPaths.set(".*/build/generated/.*")
// it's very convenient to debug stuff in the javaagent using System.out.println
// and we don't want to conditionally only check this in CI
// because then the remote gradle cache won't work for local builds
// so we check this via checkstyle instead
disable("SystemOut")
disable("BooleanParameter")
// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")
// Needs Java 9+
disable("JavaDurationGetSecondsToToSeconds")
// Still Java 8
disable("Varifier")
// Doesn't currently use Var annotations.
disable("Var") // "-Xep:Var:OFF"
// ImmutableRefactoring suggests using com.google.errorprone.annotations.Immutable,
// but currently uses javax.annotation.concurrent.Immutable
disable("ImmutableRefactoring")
// AutoValueImmutableFields suggests returning Guava types from API methods
disable("AutoValueImmutableFields")
// Suggests using Guava types for fields but we don't use Guava
disable("ImmutableMemberCollection")
// apparently disabling android doesn't disable this
disable("StaticOrDefaultInterfaceMethod")
// TODO (trask) Fix the underlying smoke test methods
disable("InconsistentOverloads")
// We don't depend on Guava so use normal splitting
disable("StringSplitter")
// allow UPPERCASE type parameter names
disable("TypeParameterNaming")
// We end up using obsolete types if a library we're instrumenting uses them.
disable("JavaUtilDate")
disable("CanIgnoreReturnValueSuggester")
// YodaConditions may improve safety in some cases. The argument of increased
// cognitive load is dubious.
disable("YodaCondition")
disable("NonFinalStaticField")
// Requires adding compile dependency to JSpecify
disable("AddNullMarkedToPackageInfo")
}
}
}
}