Skip to content

Commit ce46d76

Browse files
author
Vincent Potucek
committed
Add ConstantNaming
1 parent 6704534 commit ce46d76

File tree

1 file changed

+11
-55
lines changed

1 file changed

+11
-55
lines changed

gradle/plugins/common/src/main/kotlin/junitbuild.java-errorprone-conventions.gradle.kts

Lines changed: 11 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,62 +26,18 @@ dependencies {
2626

2727
tasks.withType<JavaCompile>().configureEach {
2828
options.errorprone {
29-
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
30-
if (name == "compileJava" && !shouldDisableErrorProne) {
31-
disable(
32-
"AnnotateFormatMethod", // We don`t want to use ErrorProne"s annotations.
33-
"BadImport", // This check is opinionated wrt. which method names it considers unsuitable for import which includes a few of our own methods in `ReflectionUtils` etc.
34-
"DoNotCallSuggester", // We don`t want to use ErrorProne"s annotations.
35-
"ImmutableEnumChecker", // We don`t want to use ErrorProne"s annotations.
36-
"InlineMeSuggester", // We don`t want to use ErrorProne"s annotations.
37-
"MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods.
38-
"StringSplitter", // We don`t want to use Guava.
39-
"UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases.
40-
// picnic (https://error-prone.picnic.tech)
41-
//"ConstantNaming",
42-
"DirectReturn", // We don`t want to use this: https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
43-
"FormatStringConcatenation",
44-
"IdentityConversion",
45-
"LexicographicalAnnotationAttributeListing", // We don`t want to use this: https://github.com/junit-team/junit-framework/pull/5043#pullrequestreview-3330615838
46-
"LexicographicalAnnotationListing",
47-
"MissingTestCall",
48-
"NestedOptionals",
49-
"NonStaticImport",
50-
"OptionalOrElseGet",
51-
"PrimitiveComparison",
52-
"StaticImport",
53-
"TimeZoneUsage",
54-
)
55-
error(
56-
"CanonicalAnnotationSyntax",
57-
"IsInstanceLambdaUsage",
58-
"PackageLocation",
59-
"RedundantStringConversion",
60-
"RedundantStringEscape",
29+
disableAllChecks = true // consider removal to avoid error prone error´s, following convention over configuration.
30+
error(
31+
"ConstantNaming",
32+
"RedundantStringConversion",
33+
)
34+
if (!getenv().containsKey("CI") && getenv("IN_PLACE").toBoolean()) {
35+
errorproneArgs.addAll(
36+
"-XepPatchLocation:IN_PLACE",
37+
"-XepPatchChecks:" +
38+
"ConstantNaming," +
39+
"RedundantStringConversion,"
6140
)
62-
if (!getenv().containsKey("CI") && getenv("IN_PLACE").toBooleanStrict()) {
63-
disableAllChecks = true
64-
errorproneArgs.addAll(
65-
"-XepPatchLocation:IN_PLACE",
66-
"-XepPatchChecks:" +
67-
"ConstantNaming," +
68-
"RedundantStringConversion,"
69-
)
70-
}
71-
} else {
72-
disableAllChecks = true
73-
}
74-
nullaway {
75-
if (shouldDisableErrorProne) {
76-
disable()
77-
} else {
78-
enable()
79-
}
80-
onlyNullMarked = true
81-
isJSpecifyMode = true
82-
customContractAnnotations.add("org.junit.platform.commons.annotation.Contract")
83-
checkContracts = true
84-
suppressionNameAliases.add("DataFlowIssue")
8541
}
8642
}
8743
}

0 commit comments

Comments
 (0)