-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[prone] Add error-prone.picnic.tech featuring RedundantStringConversion
#5006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,49 +9,53 @@ plugins { | |
| } | ||
|
|
||
| dependencies { | ||
| errorprone(dependencyFromLibs("errorProne-core")) | ||
| errorprone(dependencyFromLibs("error-prone-contrib")) | ||
| errorprone(dependencyFromLibs("error-prone-core")) | ||
| errorprone(dependencyFromLibs("nullaway")) | ||
| constraints { | ||
| errorprone("com.google.guava:guava") { | ||
| version { | ||
| require("33.4.8-jre") | ||
| } | ||
| because("Older versions use deprecated methods in sun.misc.Unsafe") | ||
| // https://github.com/junit-team/junit-framework/pull/5039#discussion_r2414490581 | ||
| } | ||
| } | ||
| } | ||
|
|
||
| nullaway { | ||
| onlyNullMarked = true | ||
| } | ||
|
|
||
| tasks.withType<JavaCompile>().configureEach { | ||
| options.errorprone { | ||
| val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9 | ||
Pankraz76 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (name == "compileJava" && !shouldDisableErrorProne) { | ||
| disable( | ||
|
|
||
| // This check is opinionated wrt. which method names it considers unsuitable for import which includes | ||
| // a few of our own methods in `ReflectionUtils` etc. | ||
| "BadImport", | ||
|
|
||
| // The findings of this check are subjective because a named constant can be more readable in many cases | ||
| "UnnecessaryLambda", | ||
|
|
||
| // Resolving findings for these checks requires ErrorProne's annotations which we don't want to use | ||
Pankraz76 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "AnnotateFormatMethod", | ||
| "AnnotateFormatMethod", // We don`t want to use ErrorProne`s annotations. | ||
marcphilipp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "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. | ||
| "DoNotCallSuggester", | ||
marcphilipp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "InlineMeSuggester", | ||
| "ImmutableEnumChecker", | ||
marcphilipp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Resolving findings for this check requires using Guava which we don't want to use | ||
| "StringSplitter", | ||
|
|
||
| // Produces a lot of findings that we consider to be false positives, for example for package-private | ||
| // classes and methods | ||
| "MissingSummary", | ||
| "InlineMeSuggester", | ||
marcphilipp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods. | ||
| "StringSplitter", // We don`t want to use Guava. | ||
| "UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases. | ||
| // picnic (https://error-prone.picnic.tech) | ||
| "ConstantNaming", | ||
| "DirectReturn", // https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446 | ||
| "FormatStringConcatenation", | ||
| "IdentityConversion", | ||
| "LexicographicalAnnotationAttributeListing", | ||
| "LexicographicalAnnotationListing", | ||
| "MissingTestCall", | ||
| "NestedOptionals", | ||
| "NonStaticImport", | ||
| "OptionalOrElseGet", | ||
| "PrimitiveComparison", | ||
| "StaticImport", | ||
| "TimeZoneUsage", | ||
Pankraz76 marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+40
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you going to address these (except There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Lexa is something easy to consider, if this meets the taste of the community. Static import is something to suggest to avoid lots of redundant context.
Everything else is then up to the community, kind of, as we definitely need all of these, as we are failing them even though it should not be necessary! (since they are not all error severity, but even low-level like suggestion). Isn't it? @rickie This itself indicates some misconfigured or problematic tooling. Thank you both for the great learning experience - both technical and foremost in social regards, which is kind of a big challenge for me personally. Please excuse me for being inconsistent sometimes. |
||
| ) | ||
| error( | ||
| "PackageLocation", | ||
| "RedundantStringConversion", | ||
| "RedundantStringEscape", | ||
| ) | ||
| error("PackageLocation") | ||
| } else { | ||
| disableAllChecks = true | ||
| } | ||
|
|
@@ -61,6 +65,7 @@ tasks.withType<JavaCompile>().configureEach { | |
| } else { | ||
| enable() | ||
| } | ||
| onlyNullMarked = true | ||
| isJSpecifyMode = true | ||
| customContractAnnotations.add("org.junit.platform.commons.annotation.Contract") | ||
| checkContracts = true | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.