Skip to content

Commit 2656784

Browse files
author
Vincent Potucek
committed
Add ConstantNaming
1 parent 17a3b0c commit 2656784

File tree

1 file changed

+14
-47
lines changed

1 file changed

+14
-47
lines changed

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

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import junitbuild.extensions.dependencyFromLibs
22
import net.ltgt.gradle.errorprone.errorprone
33
import net.ltgt.gradle.nullaway.nullaway
4+
import java.lang.System.getenv
45

56
plugins {
67
`java-library`
@@ -25,54 +26,20 @@ dependencies {
2526

2627
tasks.withType<JavaCompile>().configureEach {
2728
options.errorprone {
28-
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
29-
if (name == "compileJava" && !shouldDisableErrorProne) {
30-
disable(
31-
"AnnotateFormatMethod", // We don`t want to use ErrorProne's annotations.
32-
"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.
33-
"DoNotCallSuggester", // We don`t want to use ErrorProne's annotations.
34-
"ImmutableEnumChecker", // We don`t want to use ErrorProne's annotations.
35-
"InlineMeSuggester", // We don`t want to use ErrorProne's annotations.
36-
"MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods.
37-
"StringSplitter", // We don`t want to use Guava.
38-
"UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases.
39-
// picnic (https://error-prone.picnic.tech)
40-
"ConstantNaming",
41-
"DirectReturn", // We don`t want to use this: https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
42-
"FormatStringConcatenation",
43-
"IdentityConversion",
44-
"LexicographicalAnnotationAttributeListing", // We don`t want to use this: https://github.com/junit-team/junit-framework/pull/5043#pullrequestreview-3330615838
45-
"LexicographicalAnnotationListing",
46-
"MissingTestCall",
47-
"NestedOptionals",
48-
"NonStaticImport",
49-
"OptionalOrElseGet",
50-
"PrimitiveComparison",
51-
"StaticImport",
52-
"TimeZoneUsage",
53-
)
54-
error(
55-
"CanonicalAnnotationSyntax",
56-
"IsInstanceLambdaUsage",
57-
"PackageLocation",
58-
"RedundantStringConversion",
59-
"RedundantStringEscape",
29+
disableAllChecks = true // consider removal to avoid error prone error´s, following convention over configuration.
30+
allErrorsAsWarnings = true
31+
error(
32+
//"ConstantNaming",
33+
"RedundantStringConversion",
34+
)
35+
// if (!getenv().containsKey("CI") && getenv("IN_PLACE").toBoolean()) {
36+
errorproneArgs.addAll(
37+
"-XepPatchLocation:IN_PLACE",
38+
"-XepPatchChecks:" +
39+
"ConstantNaming," +
40+
"RedundantStringConversion,"
6041
)
61-
} else {
62-
disableAllChecks = true
63-
}
64-
nullaway {
65-
if (shouldDisableErrorProne) {
66-
disable()
67-
} else {
68-
enable()
69-
}
70-
onlyNullMarked = true
71-
isJSpecifyMode = true
72-
customContractAnnotations.add("org.junit.platform.commons.annotation.Contract")
73-
checkContracts = true
74-
suppressionNameAliases.add("DataFlowIssue")
75-
}
42+
// }
7643
}
7744
}
7845

0 commit comments

Comments
 (0)