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