Skip to content

Commit 7aec747

Browse files
authored
Sync ErrorProne configuration with OpenTelemetry Java instrumentation (#4364)
1 parent bfec1cb commit 7aec747

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

buildSrc/src/main/kotlin/ai.errorprone-conventions.gradle.kts

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,59 +22,66 @@ 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")
39-
4036
// Doesn't work well with Java 8
4137
disable("FutureReturnValueIgnored")
4238

4339
// Needs Java 9+
4440
disable("JavaDurationGetSecondsToToSeconds")
4541

46-
// Require Guava
42+
// Still Java 8
43+
disable("Varifier")
44+
45+
// Doesn't currently use Var annotations.
46+
disable("Var") // "-Xep:Var:OFF"
47+
48+
// ImmutableRefactoring suggests using com.google.errorprone.annotations.Immutable,
49+
// but currently uses javax.annotation.concurrent.Immutable
50+
disable("ImmutableRefactoring")
51+
52+
// AutoValueImmutableFields suggests returning Guava types from API methods
4753
disable("AutoValueImmutableFields")
48-
disable("StringSplitter")
54+
// Suggests using Guava types for fields but we don't use Guava
4955
disable("ImmutableMemberCollection")
5056

51-
// Don't currently use this (to indicate a local variable that's mutated) but could
52-
// consider for future.
53-
disable("Var")
54-
55-
// Don't support Android without desugar
57+
// TODO (trask) use animal sniffer
5658
disable("AndroidJdkLibsChecker")
59+
60+
// apparently disabling android doesn't disable this
5761
disable("StaticOrDefaultInterfaceMethod")
5862

59-
// needed temporarily while hosting azure-monitor-opentelemetry-exporter in this repo
60-
disable("MissingSummary")
61-
disable("UnnecessaryDefaultInEnumSwitch")
63+
// TODO (trask) Fix the underlying smoke test methods
6264
disable("InconsistentOverloads")
6365

64-
disable("CanIgnoreReturnValueSuggester")
66+
// We don't depend on Guava so use normal splitting
67+
disable("StringSplitter")
6568

66-
disable("NonFinalStaticField")
69+
// allow UPPERCASE type parameter names
70+
disable("TypeParameterNaming")
71+
72+
// We end up using obsolete types if a library we're instrumenting uses them.
73+
disable("JavaUtilDate")
74+
75+
disable("CanIgnoreReturnValueSuggester")
6776

6877
// YodaConditions may improve safety in some cases. The argument of increased
6978
// cognitive load is dubious.
7079
disable("YodaCondition")
7180

81+
disable("NonFinalStaticField")
82+
7283
// Requires adding compile dependency to JSpecify
7384
disable("AddNullMarkedToPackageInfo")
74-
75-
if (name.contains("Jmh")) {
76-
disable("MemberName")
77-
}
7885
}
7986
}
8087
}

0 commit comments

Comments
 (0)