|
| 1 | +import static java.lang.System.getenv |
| 2 | + |
| 3 | +apply plugin: 'net.ltgt.errorprone' |
| 4 | + |
| 5 | +dependencies { |
| 6 | + errorprone('com.google.errorprone:error_prone_core:2.42.0') |
| 7 | + errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.25.0') |
| 8 | + errorprone('tech.picnic.error-prone-support:refaster-runner:0.25.0') |
| 9 | +} |
| 10 | + |
| 11 | +tasks.withType(JavaCompile).configureEach { |
| 12 | + options.errorprone { |
| 13 | + allErrorsAsWarnings = true |
| 14 | + disableWarningsInGeneratedCode = true |
| 15 | + disable( |
| 16 | + // avoid |
| 17 | + 'StaticImport', |
| 18 | + // bug |
| 19 | + 'AddNullMarkedToPackageInfo', |
| 20 | + 'Slf4jLogStatement', |
| 21 | + 'Slf4jLogStatement', |
| 22 | + ) |
| 23 | + // dev opt-in |
| 24 | + if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) { |
| 25 | + // apply |
| 26 | + errorproneArgs.addAll( |
| 27 | + '-XepPatchLocation:IN_PLACE', |
| 28 | + '-XepPatchChecks:' + |
| 29 | + 'AddNullMarkedToPackageInfo,' + |
| 30 | + 'AlwaysThrows,' + |
| 31 | + 'AmbiguousJsonCreator,' + |
| 32 | + 'AndroidInjectionBeforeSuper,' + |
| 33 | + 'ArrayEquals,' + |
| 34 | + 'ArrayFillIncompatibleType,' + |
| 35 | + 'ArrayHashCode,' + |
| 36 | + 'ArrayToString,' + |
| 37 | + 'ArraysAsListPrimitiveArray,' + |
| 38 | + 'AssertJNullnessAssertion,' + |
| 39 | + 'AsyncCallableReturnsNull,' + |
| 40 | + 'AsyncFunctionReturnsNull,' + |
| 41 | + 'AutoValueBuilderDefaultsInConstructor,' + |
| 42 | + 'AutoValueConstructorOrderChecker,' + |
| 43 | + 'AutowiredConstructor,' + |
| 44 | + 'BadAnnotationImplementation,' + |
| 45 | + 'BadShiftAmount,' + |
| 46 | + 'BanJNDI,' + |
| 47 | + 'BoxedPrimitiveEquality,' + |
| 48 | + 'BundleDeserializationCast,' + |
| 49 | + 'CanonicalAnnotationSyntax,' + |
| 50 | + 'CanonicalClassNameUsage,' + |
| 51 | + 'ChainingConstructorIgnoresParameter,' + |
| 52 | + 'CheckNotNullMultipleTimes,' + |
| 53 | + 'CheckReturnValue,' + |
| 54 | + 'ClassCastLambdaUsage,' + |
| 55 | + 'CollectionIncompatibleType,' + |
| 56 | + 'CollectionToArraySafeParameter,' + |
| 57 | + 'CollectorMutability,' + |
| 58 | + 'ComparableType,' + |
| 59 | + 'ComparingThisWithNull,' + |
| 60 | + 'ComparisonOutOfRange,' + |
| 61 | + 'CompatibleWithAnnotationMisuse,' + |
| 62 | + 'CompileTimeConstant,' + |
| 63 | + 'ComputeIfAbsentAmbiguousReference,' + |
| 64 | + 'ConditionalExpressionNumericPromotion,' + |
| 65 | + 'ConstantNaming,' + |
| 66 | + 'ConstantOverflow,' + |
| 67 | + 'DaggerProvidesNull,' + |
| 68 | + 'DangerousLiteralNull,' + |
| 69 | + 'DeadException,' + |
| 70 | + 'DeadThread,' + |
| 71 | + 'DefaultCharset,' + |
| 72 | + 'DereferenceWithNullBranch,' + |
| 73 | + 'DirectReturn,' + |
| 74 | + 'DiscardedPostfixExpression,' + |
| 75 | + 'DoNotCall,' + |
| 76 | + 'DoNotMock,' + |
| 77 | + 'DoubleBraceInitialization,' + |
| 78 | + 'DuplicateMapKeys,' + |
| 79 | + 'DurationFrom,' + |
| 80 | + 'DurationGetTemporalUnit,' + |
| 81 | + 'DurationTemporalUnit,' + |
| 82 | + 'DurationToLongTimeUnit,' + |
| 83 | + 'EagerStringFormatting,' + |
| 84 | + 'EmptyMethod,' + |
| 85 | + 'EmptyMonoZip,' + |
| 86 | + 'EqualsHashCode,' + |
| 87 | + 'EqualsNaN,' + |
| 88 | + 'EqualsNull,' + |
| 89 | + 'EqualsReference,' + |
| 90 | + 'EqualsWrongThing,' + |
| 91 | + 'ExplicitArgumentEnumeration,' + |
| 92 | + 'ExplicitEnumOrdering,' + |
| 93 | + 'FloggerFormatString,' + |
| 94 | + 'FloggerLogString,' + |
| 95 | + 'FloggerLogVarargs,' + |
| 96 | + 'FloggerSplitLogStatement,' + |
| 97 | + 'FluxFlatMapUsage,' + |
| 98 | + 'FluxImplicitBlock,' + |
| 99 | + 'ForOverride,' + |
| 100 | + 'FormatString,' + |
| 101 | + 'FormatStringAnnotation,' + |
| 102 | + 'FormatStringConcatenation,' + |
| 103 | + 'FromTemporalAccessor,' + |
| 104 | + 'FunctionalInterfaceMethodChanged,' + |
| 105 | + 'FunctionalInterfaceMethodChanged,' + |
| 106 | + 'FuturesGetCheckedIllegalExceptionType,' + |
| 107 | + 'FuzzyEqualsShouldNotBeUsedInEqualsMethod,' + |
| 108 | + 'GetClassOnAnnotation,' + |
| 109 | + 'GetClassOnClass,' + |
| 110 | + 'GuardedBy,' + |
| 111 | + 'GuiceAssistedInjectScoping,' + |
| 112 | + 'GuiceAssistedParameters,' + |
| 113 | + 'GuiceInjectOnFinalField,' + |
| 114 | + 'HashtableContains,' + |
| 115 | + 'IdentityBinaryExpression,' + |
| 116 | + 'IdentityConversion,' + |
| 117 | + 'IdentityHashMapBoxing,' + |
| 118 | + 'Immutable,' + |
| 119 | + 'ImmutableEnumChecker,' + |
| 120 | + 'ImmutablesSortedSetComparator,' + |
| 121 | + 'ImpossibleNullComparison,' + |
| 122 | + 'Incomparable,' + |
| 123 | + 'IncompatibleArgumentType,' + |
| 124 | + 'IncompatibleModifiers,' + |
| 125 | + 'IndexOfChar,' + |
| 126 | + 'InexactVarargsConditional,' + |
| 127 | + 'InfiniteRecursion,' + |
| 128 | + 'InjectMoreThanOneScopeAnnotationOnClass,' + |
| 129 | + 'InjectOnMemberAndConstructor,' + |
| 130 | + 'InlineMeValidator,' + |
| 131 | + 'InstantTemporalUnit,' + |
| 132 | + 'InvalidJavaTimeConstant,' + |
| 133 | + 'InvalidPatternSyntax,' + |
| 134 | + 'InvalidTimeZoneID,' + |
| 135 | + 'InvalidZoneId,' + |
| 136 | + 'IsInstanceIncompatibleType,' + |
| 137 | + 'IsInstanceLambdaUsage,' + |
| 138 | + 'IsInstanceOfClass,' + |
| 139 | + 'IsLoggableTagLength,' + |
| 140 | + 'JUnit3TestNotRun,' + |
| 141 | + 'JUnit4ClassAnnotationNonStatic,' + |
| 142 | + 'JUnit4SetUpNotRun,' + |
| 143 | + 'JUnit4TearDownNotRun,' + |
| 144 | + 'JUnit4TestNotRun,' + |
| 145 | + 'JUnit4TestsNotRunWithinEnclosed,' + |
| 146 | + 'JUnitAssertSameCheck,' + |
| 147 | + 'JUnitClassModifiers,' + |
| 148 | + 'JUnitMethodDeclaration,' + |
| 149 | + 'JUnitNullaryParameterizedTestDeclaration,' + |
| 150 | + 'JUnitParameterMethodNotFound,' + |
| 151 | + 'JUnitValueSource,' + |
| 152 | + 'JavaxInjectOnAbstractMethod,' + |
| 153 | + 'JodaToSelf,' + |
| 154 | + 'LenientFormatStringValidation,' + |
| 155 | + 'LexicographicalAnnotationAttributeListing,' + |
| 156 | + 'LexicographicalAnnotationListing,' + |
| 157 | + 'LiteByteStringUtf8,' + |
| 158 | + 'LocalDateTemporalAmount,' + |
| 159 | + 'LockOnBoxedPrimitive,' + |
| 160 | + 'LoopConditionChecker,' + |
| 161 | + 'LossyPrimitiveCompare,' + |
| 162 | + 'MathRoundIntLong,' + |
| 163 | + 'MislabeledAndroidString,' + |
| 164 | + 'MisleadingEmptyVarargs,' + |
| 165 | + 'MisleadingEscapedSpace,' + |
| 166 | + 'MisplacedScopeAnnotations,' + |
| 167 | + 'MissingOverride,' + |
| 168 | + 'MissingSuperCall,' + |
| 169 | + 'MissingTestCall,' + |
| 170 | + 'MisusedDayOfYear,' + |
| 171 | + 'MisusedWeekYear,' + |
| 172 | + 'MixedDescriptors,' + |
| 173 | + 'MockitoMockClassReference,' + |
| 174 | + 'MockitoStubbing,' + |
| 175 | + 'MockitoUsage,' + |
| 176 | + 'ModifyingCollectionWithItself,' + |
| 177 | + 'MongoDBTextFilterUsage,' + |
| 178 | + 'MoreThanOneInjectableConstructor,' + |
| 179 | + 'MustBeClosedChecker,' + |
| 180 | + 'NCopiesOfChar,' + |
| 181 | + 'NestedOptionals,' + |
| 182 | + 'NestedPublishers,' + |
| 183 | + 'NoCanIgnoreReturnValueOnClasses,' + |
| 184 | + 'NonCanonicalStaticImport,' + |
| 185 | + 'NonEmptyMono,' + |
| 186 | + 'NonFinalCompileTimeConstant,' + |
| 187 | + 'NonRuntimeAnnotation,' + |
| 188 | + 'NonStaticImport,' + |
| 189 | + 'NullArgumentForNonNullParameter,' + |
| 190 | + 'NullTernary,' + |
| 191 | + 'NullableOnContainingClass,' + |
| 192 | + 'OptionalEquality,' + |
| 193 | + 'OptionalMapUnusedValue,' + |
| 194 | + 'OptionalOfRedundantMethod,' + |
| 195 | + 'OptionalOrElseGet,' + |
| 196 | + 'OverlappingQualifierAndScopeAnnotation,' + |
| 197 | + 'OverridesJavaxInjectableMethod,' + |
| 198 | + 'PackageInfo,' + |
| 199 | + 'ParametersButNotParameterized,' + |
| 200 | + 'ParcelableCreator,' + |
| 201 | + 'PeriodFrom,' + |
| 202 | + 'PeriodGetTemporalUnit,' + |
| 203 | + 'PeriodTimeMath,' + |
| 204 | + 'PreconditionsInvalidPlaceholder,' + |
| 205 | + 'PrimitiveComparison,' + |
| 206 | + 'PrivateSecurityContractProtoAccess,' + |
| 207 | + 'ProtoBuilderReturnValueIgnored,' + |
| 208 | + 'ProtoStringFieldReferenceEquality,' + |
| 209 | + 'ProtoTruthMixedDescriptors,' + |
| 210 | + 'ProtocolBufferOrdinal,' + |
| 211 | + 'ProvidesMethodOutsideOfModule,' + |
| 212 | + 'RandomCast,' + |
| 213 | + 'RandomModInteger,' + |
| 214 | + 'RectIntersectReturnValueIgnored,' + |
| 215 | + 'RedundantSetterCall,' + |
| 216 | + 'RedundantStringConversion,' + |
| 217 | + 'RedundantStringEscape,' + |
| 218 | + 'RefasterAnyOfUsage,' + |
| 219 | + 'RequestMappingAnnotation,' + |
| 220 | + 'RequestParamType,' + |
| 221 | + 'RequiredModifiers,' + |
| 222 | + 'RestrictedApi,' + |
| 223 | + 'ReturnValueIgnored,' + |
| 224 | + 'SelfAssertion,' + |
| 225 | + 'SelfAssignment,' + |
| 226 | + 'SelfComparison,' + |
| 227 | + 'SelfEquals,' + |
| 228 | + 'SetUnrecognized,' + |
| 229 | + 'ShouldHaveEvenArgs,' + |
| 230 | + 'SizeGreaterThanOrEqualsZero,' + |
| 231 | + 'Slf4jLogStatement,' + |
| 232 | + 'Slf4jLoggerDeclarationSlf4jLoggerDeclaration,' + |
| 233 | + 'SpringMvcAnnotation,' + |
| 234 | + 'StreamToString,' + |
| 235 | + 'StringBuilderInitWithChar,' + |
| 236 | + 'StringJoin,' + |
| 237 | + 'SubstringOfZero,' + |
| 238 | + 'SuppressWarningsDeprecated,' + |
| 239 | + 'TemporalAccessorGetChronoField,' + |
| 240 | + 'TestParametersNotInitialized,' + |
| 241 | + 'TheoryButNoTheories,' + |
| 242 | + 'ThreadBuilderNameWithPlaceholder,' + |
| 243 | + 'ThrowIfUncheckedKnownChecked,' + |
| 244 | + 'ThrowNull,' + |
| 245 | + 'TimeZoneUsage,' + |
| 246 | + 'TreeToString,' + |
| 247 | + 'TryFailThrowable,' + |
| 248 | + 'TypeParameterQualifier,' + |
| 249 | + 'UnicodeDirectionalityCharacters,' + |
| 250 | + 'UnicodeInCode,' + |
| 251 | + 'UnnecessaryCheckNotNull,' + |
| 252 | + 'UnnecessaryTypeArgument,' + |
| 253 | + 'UnsafeWildcard,' + |
| 254 | + 'UnusedAnonymousClass,' + |
| 255 | + 'UnusedCollectionModifiedInPlace,' + |
| 256 | + 'VarTypeName,' + |
| 257 | + 'WrongOneof,' + |
| 258 | + 'XorPower,' + |
| 259 | + 'ZoneIdOfZ,' |
| 260 | + ) |
| 261 | + } |
| 262 | + } |
| 263 | +} |
0 commit comments