|
| 1 | +import static java.lang.System.getenv |
| 2 | + |
| 3 | +apply plugin: 'net.ltgt.errorprone' |
| 4 | + |
| 5 | +tasks.withType(JavaCompile).configureEach { |
| 6 | + options.errorprone { |
| 7 | + disableAllWarnings = true // https://github.com/diffplug/spotless/issues/2745 https://github.com/google/error-prone/issues/5365 |
| 8 | + disable( |
| 9 | + // consider fix, or reasoning. |
| 10 | + 'AnnotateFormatMethod', // We don`t want to use ErrorProne's annotations. |
| 11 | + 'DoNotCallSuggester', // We don`t want to use ErrorProne's annotations. |
| 12 | + 'FunctionalInterfaceMethodChanged', |
| 13 | + 'ImmutableEnumChecker', // We don`t want to use ErrorProne's annotations. |
| 14 | + 'InlineMeSuggester', // We don`t want to use ErrorProne's annotations. |
| 15 | + 'JavaxInjectOnAbstractMethod', |
| 16 | + 'OverridesJavaxInjectableMethod', |
| 17 | + 'ReturnValueIgnored', // We don`t want to use ErrorProne's annotations. |
| 18 | + ) |
| 19 | + error( |
| 20 | + 'ReturnValueIgnored', |
| 21 | + 'SelfAssignment', |
| 22 | + 'StringJoin', |
| 23 | + 'UnnecessarilyFullyQualified', |
| 24 | + 'UnnecessaryLambda', |
| 25 | + ) |
| 26 | + // bug: this only happens when the file is dirty. |
| 27 | + // might be an up2date (caching) issue, as file is currently in corrupt state. |
| 28 | + // ForbidGradleInternal(import |
| 29 | + excludedPaths.set( |
| 30 | + '.*/GradleIntegrationHarness.java|'+ |
| 31 | + '.*/SelfTest.java' |
| 32 | + ) |
| 33 | + if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) { |
| 34 | + errorproneArgs.addAll( |
| 35 | + '-XepPatchLocation:IN_PLACE', |
| 36 | + '-XepPatchChecks:' + |
| 37 | + 'MissingOverride' |
| 38 | + ) |
| 39 | + } |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +dependencies { |
| 44 | + errorprone('com.google.errorprone:error_prone_core:2.42.0') |
| 45 | +} |
0 commit comments