@@ -22,57 +22,118 @@ tasks {
2222 disableWarningsInGeneratedCode.set(true )
2323 allDisabledChecksAsWarnings.set(true )
2424
25+ // Ignore warnings for generated classes
2526 excludedPaths.set(" .*/build/generated/.*" )
2627
27- if (System .getenv(" CI" ) == null ) {
28- disable(" SystemOut" )
29- }
30-
31- // Still Java 8
32- disable(" Varifier" )
28+ // it's very convenient to debug stuff in the javaagent using System.out.println
29+ // and we don't want to conditionally only check this in CI
30+ // because then the remote gradle cache won't work for local builds
31+ // so we check this via checkstyle instead
32+ disable(" SystemOut" )
3333
34- // Intellij does a nice job of displaying parameter names
3534 disable(" BooleanParameter" )
3635
37- // Needed for legacy 2.x bridge
38- disable(" JavaUtilDate" )
36+ // We often override a method returning Iterable which this makes tedious
37+ // for questionable value.
38+ disable(" PreferredInterfaceType" )
3939
4040 // Doesn't work well with Java 8
4141 disable(" FutureReturnValueIgnored" )
4242
43- // Needs Java 9+
44- disable(" JavaDurationGetSecondsToToSeconds" )
43+ // Still Java 8
44+ disable(" Varifier" )
45+
46+ // Doesn't currently use Var annotations.
47+ disable(" Var" ) // "-Xep:Var:OFF"
48+
49+ // ImmutableRefactoring suggests using com.google.errorprone.annotations.Immutable,
50+ // but currently uses javax.annotation.concurrent.Immutable
51+ disable(" ImmutableRefactoring" )
4552
46- // Require Guava
53+ // AutoValueImmutableFields suggests returning Guava types from API methods
4754 disable(" AutoValueImmutableFields" )
48- disable( " StringSplitter " )
55+ // Suggests using Guava types for fields but we don't use Guava
4956 disable(" ImmutableMemberCollection" )
5057
51- // Don't currently use this (to indicate a local variable that's mutated) but could
52- // consider for future .
53- disable(" Var " )
58+ // Fully qualified names may be necessary when deprecating a class to avoid
59+ // deprecation warning .
60+ disable(" UnnecessarilyFullyQualified " )
5461
55- // Don't support Android without desugar
62+ // TODO (trask) use animal sniffer
63+ disable(" Java8ApiChecker" )
5664 disable(" AndroidJdkLibsChecker" )
65+
66+ // apparently disabling android doesn't disable this
5767 disable(" StaticOrDefaultInterfaceMethod" )
5868
59- // needed temporarily while hosting azure-monitor-opentelemetry-exporter in this repo
60- disable(" MissingSummary" )
61- disable(" UnnecessaryDefaultInEnumSwitch" )
62- disable(" InconsistentOverloads" )
69+ // We don't depend on Guava so use normal splitting
70+ disable(" StringSplitter" )
71+
72+ // Prevents lazy initialization
73+ disable(" InitializeInline" )
74+
75+ // Seems to trigger even when a deprecated method isn't called anywhere.
76+ // We don't get much benefit from it anyways.
77+ disable(" InlineMeSuggester" )
78+
79+ disable(" DoNotCallSuggester" )
80+
81+ // We have nullaway so don't need errorprone nullable checks which have more false positives.
82+ disable(" FieldMissingNullable" )
83+ disable(" ParameterMissingNullable" )
84+ disable(" ReturnMissingNullable" )
85+ disable(" VoidMissingNullable" )
86+
87+ // allow UPPERCASE type parameter names
88+ disable(" TypeParameterNaming" )
89+
90+ // In bytecode instrumentation it's very common to separate across onEnter / onExit
91+ // TODO: Only disable for javaagent instrumentation modules.
92+ disable(" MustBeClosedChecker" )
93+
94+ // Common to avoid an allocation. Revisit if it's worth opt-in suppressing instead of
95+ // disabling entirely.
96+ disable(" MixedMutabilityReturnType" )
97+
98+ // We end up using obsolete types if a library we're instrumenting uses them.
99+ disable(" JdkObsolete" )
100+ disable(" JavaUtilDate" )
101+
102+ // TODO: Remove this, we use this pattern in several tests and it will mean some moving.
103+ disable(" DefaultPackage" )
104+
105+ // We don't have custom checks like OpenTelemetry, so disable the standard utility class check
106+ disable(" PrivateConstructorForUtilityClass" )
63107
64108 disable(" CanIgnoreReturnValueSuggester" )
65109
66- disable(" NonFinalStaticField" )
110+ // TODO: Remove this, probably after instrumenter API migration instead of dealing with
111+ // older APIs.
112+ disable(" InconsistentOverloads" )
113+
114+ // lots of low level APIs use arrays
115+ disable(" AvoidObjectArrays" )
116+
117+ disable(" BanClassLoader" )
67118
68119 // YodaConditions may improve safety in some cases. The argument of increased
69120 // cognitive load is dubious.
70121 disable(" YodaCondition" )
71122
123+ disable(" NonFinalStaticField" )
124+
72125 // Requires adding compile dependency to JSpecify
73126 disable(" AddNullMarkedToPackageInfo" )
74127
75- if (name.contains(" Jmh" )) {
128+ // needed temporarily while hosting azure-monitor-opentelemetry-exporter in this repo
129+ disable(" MissingSummary" )
130+ disable(" UnnecessaryDefaultInEnumSwitch" )
131+
132+ // Needs Java 9+
133+ disable(" JavaDurationGetSecondsToToSeconds" )
134+
135+ if (name.contains(" Jmh" ) || name.contains(" Test" )) {
136+ // Allow underscore in test-type method names
76137 disable(" MemberName" )
77138 }
78139 }
0 commit comments