aboutsummaryrefslogtreecommitdiffstats
path: root/tools/BUILD
blob: 844f0049e686df4d1254ed695efc869fbe8ab78d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
load(
    "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
    "default_java_toolchain",
)
load("@rules_java//java:defs.bzl", "java_package_configuration")

default_java_toolchain(
    name = "error_prone_warnings_toolchain_java17",
    configuration = dict(),
    java_runtime = "@rules_java//toolchains:remotejdk_17",
    package_configuration = [
        ":error_prone",
        ":error_prone_tests",
    ],
    source_version = "17",
    target_version = "17",
    visibility = ["//visibility:public"],
)

default_java_toolchain(
    name = "error_prone_warnings_toolchain_java21",
    configuration = dict(),
    java_runtime = "@rules_java//toolchains:remotejdk_21",
    package_configuration = [
        ":error_prone",
        ":error_prone_tests",
    ],
    source_version = "21",
    target_version = "21",
    visibility = ["//visibility:public"],
)

# Error Prone errors enabled by default; see ../.bazelrc for how this is
# enabled. This warnings list is originally based on:
# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl
# However, feel free to add any additional errors. Thus far they have all been pretty useful.
errorprone_checks = [
        "-XepDisableWarningsInGeneratedCode",
        # The XepDisableWarningsInGeneratedCode disables only warnings, but
        # not errors. We should manually exclude all files generated by
        # AutoValue; such files always start $AutoValue_.....
        # XepExcludedPaths is a regexp. If you need more paths - use | as
        # separator.
        "-XepExcludedPaths:.*/\\\\$$AutoValue_.*\\.java",
        "-Xep:AlmostJavadoc:ERROR",
        "-Xep:AlwaysThrows:ERROR",
        "-Xep:AmbiguousMethodReference:ERROR",
        # don't want to add dependency to errorprone
        "-Xep:AnnotateFormatMethod:OFF",
        "-Xep:ArgumentSelectionDefectChecker:ERROR",
        "-Xep:ArrayAsKeyOfSetOrMap:ERROR",
        "-Xep:ArrayEquals:ERROR",
        "-Xep:ArrayFillIncompatibleType:ERROR",
        "-Xep:ArrayHashCode:ERROR",
        "-Xep:ArraysAsListPrimitiveArray:ERROR",
        "-Xep:ArrayToString:ERROR",
        "-Xep:AssertEqualsArgumentOrderChecker:ERROR",
        "-Xep:AssertionFailureIgnored:WARN",
        "-Xep:AsyncCallableReturnsNull:ERROR",
        "-Xep:AsyncFunctionReturnsNull:ERROR",
        "-Xep:AutoValueConstructorOrderChecker:ERROR",
        "-Xep:AutoValueFinalMethods:ERROR",
        "-Xep:AutoValueImmutableFields:ERROR",
        "-Xep:AutoValueSubclassLeaked:WARN",
        "-Xep:BadAnnotationImplementation:ERROR",
        "-Xep:BadComparable:ERROR",
        "-Xep:BadImport:ERROR",
        "-Xep:BadInstanceof:ERROR",
        "-Xep:BadShiftAmount:ERROR",
        "-Xep:BanSerializableRead:ERROR",
        "-Xep:BigDecimalEquals:ERROR",
        "-Xep:BigDecimalLiteralDouble:ERROR",
        "-Xep:BoxedPrimitiveConstructor:ERROR",
        "-Xep:BoxedPrimitiveEquality:ERROR",
        "-Xep:BundleDeserializationCast:ERROR",
        "-Xep:ByteBufferBackingArray:WARN",
        "-Xep:CacheLoaderNull:ERROR",
        "-Xep:CannotMockFinalClass:ERROR",
        "-Xep:CanonicalDuration:ERROR",
        "-Xep:CatchAndPrintStackTrace:ERROR",
        "-Xep:CatchFail:ERROR",
        "-Xep:ChainedAssertionLosesContext:ERROR",
        "-Xep:ChainingConstructorIgnoresParameter:ERROR",
        "-Xep:CharacterGetNumericValue:ERROR",
        "-Xep:CheckNotNullMultipleTimes:ERROR",
        "-Xep:CheckReturnValue:ERROR",
        "-Xep:ClassCanBeStatic:ERROR",
        "-Xep:ClassName:ERROR",
        "-Xep:ClassNewInstance:ERROR",
        "-Xep:CollectionIncompatibleType:ERROR",
        "-Xep:CollectionToArraySafeParameter:ERROR",
        "-Xep:CollectionUndefinedEquality:ERROR",
        "-Xep:CollectorShouldNotUseState:ERROR",
        "-Xep:ComparableAndComparator:ERROR",
        "-Xep:ComparableType:ERROR",
        "-Xep:CompareToZero:ERROR",
        "-Xep:ComparingThisWithNull:ERROR",
        "-Xep:ComparisonOutOfRange:ERROR",
        "-Xep:CompatibleWithAnnotationMisuse:ERROR",
        "-Xep:CompileTimeConstant:ERROR",
        "-Xep:ComplexBooleanConstant:ERROR",
        "-Xep:ComputeIfAbsentAmbiguousReference:ERROR",
        "-Xep:ConditionalExpressionNumericPromotion:ERROR",
        "-Xep:ConstantOverflow:ERROR",
        "-Xep:DaggerProvidesNull:ERROR",
        "-Xep:DangerousLiteralNull:ERROR",
        "-Xep:DateChecker:ERROR",
        "-Xep:DateFormatConstant:ERROR",
        "-Xep:DeadException:ERROR",
        "-Xep:DeadThread:ERROR",
        "-Xep:DefaultCharset:ERROR",
        "-Xep:DefaultPackage:ERROR",
        "-Xep:DepAnn:ERROR",
        "-Xep:DeprecatedVariable:ERROR",
        "-Xep:DiscardedPostfixExpression:ERROR",
        "-Xep:DoNotCall:ERROR",
        "-Xep:DoNotCallSuggester:ERROR",
        "-Xep:DoNotClaimAnnotations:ERROR",
        "-Xep:DoNotMock:ERROR",
        "-Xep:DoNotMockAutoValue:WARN",
        "-Xep:DoubleBraceInitialization:ERROR",
        "-Xep:DoubleCheckedLocking:ERROR",
        "-Xep:DuplicateMapKeys:ERROR",
        "-Xep:DurationFrom:ERROR",
        "-Xep:DurationGetTemporalUnit:ERROR",
        "-Xep:DurationTemporalUnit:ERROR",
        "-Xep:DurationToLongTimeUnit:ERROR",
        "-Xep:EmptyBlockTag:WARN",
        "-Xep:EmptyCatch:ERROR",
        "-Xep:EmptySetMultibindingContributions:ERROR",
        "-Xep:EqualsGetClass:ERROR",
        "-Xep:EqualsHashCode:ERROR",
        "-Xep:EqualsIncompatibleType:ERROR",
        "-Xep:EqualsNaN:ERROR",
        "-Xep:EqualsNull:ERROR",
        "-Xep:EqualsReference:ERROR",
        "-Xep:EqualsUnsafeCast:ERROR",
        "-Xep:EqualsUsingHashCode:ERROR",
        "-Xep:EqualsWrongThing:ERROR",
        "-Xep:ErroneousThreadPoolConstructorChecker:ERROR",
        "-Xep:EscapedEntity:WARN",
        "-Xep:ExpectedExceptionChecker:ERROR",
        "-Xep:ExtendingJUnitAssert:ERROR",
        "-Xep:ExtendsAutoValue:ERROR",
        "-Xep:FallThrough:ERROR",
        "-Xep:Finally:ERROR",
        "-Xep:FloatCast:ERROR",
        "-Xep:FloatingPointAssertionWithinEpsilon:ERROR",
        "-Xep:FloatingPointLiteralPrecision:ERROR",
        "-Xep:FloggerArgumentToString:ERROR",
        "-Xep:FloggerFormatString:ERROR",
        "-Xep:FloggerLogVarargs:ERROR",
        "-Xep:FloggerSplitLogStatement:ERROR",
        "-Xep:FloggerStringConcatenation:ERROR",
        "-Xep:FormatString:ERROR",
        "-Xep:FormatStringAnnotation:ERROR",
        "-Xep:ForOverride:ERROR",
        "-Xep:FragmentInjection:ERROR",
        "-Xep:FragmentNotInstantiable:ERROR",
        "-Xep:FromTemporalAccessor:ERROR",
        "-Xep:FunctionalInterfaceClash:ERROR",
        "-Xep:FunctionalInterfaceMethodChanged:ERROR",
        "-Xep:FutureReturnValueIgnored:ERROR",
        "-Xep:FuturesGetCheckedIllegalExceptionType:ERROR",
        "-Xep:GetClassOnAnnotation:ERROR",
        "-Xep:GetClassOnClass:ERROR",
        "-Xep:GetClassOnEnum:ERROR",
        "-Xep:GuardedBy:ERROR",
        "-Xep:GuiceAssistedInjectScoping:ERROR",
        "-Xep:GuiceAssistedParameters:ERROR",
        "-Xep:HashtableContains:ERROR",
        "-Xep:HidingField:WARN",
        "-Xep:IdentityBinaryExpression:ERROR",
        "-Xep:IdentityHashMapBoxing:ERROR",
        "-Xep:IdentityHashMapUsage:ERROR",
        "-Xep:IgnoredPureGetter:ERROR",
        "-Xep:Immutable:ERROR",
        "-Xep:ImmutableAnnotationChecker:ERROR",
        "-Xep:ImmutableEnumChecker:ERROR",
        "-Xep:ImmutableModification:ERROR",
        "-Xep:Incomparable:ERROR",
        "-Xep:IncompatibleArgumentType:ERROR",
        "-Xep:IncompatibleModifiers:ERROR",
        "-Xep:InconsistentCapitalization:WARN",
        "-Xep:InconsistentHashCode:ERROR",
        "-Xep:IncrementInForLoopAndHeader:ERROR",
        "-Xep:IndexOfChar:ERROR",
        "-Xep:InexactVarargsConditional:ERROR",
        "-Xep:InfiniteRecursion:ERROR",
        "-Xep:InheritDoc:ERROR",
        "-Xep:InjectOnConstructorOfAbstractClass:ERROR",
        "-Xep:InlineFormatString:ERROR",
        "-Xep:InlineMeInliner:ERROR",
        # don't want to add dependency to errorprone
        "-Xep:InlineMeSuggester:OFF",
        "-Xep:InlineMeValidator:ERROR",
        "-Xep:InputStreamSlowMultibyteRead:ERROR",
        "-Xep:InsecureCryptoUsage:ERROR",
        "-Xep:InstanceOfAndCastMatchWrongType:ERROR",
        "-Xep:InstantTemporalUnit:ERROR",
        "-Xep:IntLongMath:ERROR",
        "-Xep:InvalidBlockTag:ERROR",
        "-Xep:InvalidInlineTag:ERROR",
        "-Xep:InvalidJavaTimeConstant:ERROR",
        "-Xep:InvalidLink:ERROR",
        "-Xep:InvalidParam:ERROR",
        "-Xep:InvalidPatternSyntax:ERROR",
        "-Xep:InvalidThrows:ERROR",
        "-Xep:InvalidThrowsLink:ERROR",
        "-Xep:InvalidTimeZoneID:ERROR",
        "-Xep:InvalidZoneId:ERROR",
        "-Xep:IsInstanceIncompatibleType:ERROR",
        "-Xep:IsInstanceOfClass:ERROR",
        "-Xep:IsLoggableTagLength:ERROR",
        "-Xep:IterableAndIterator:ERROR",
        "-Xep:IterablePathParameter:ERROR",
        "-Xep:JavaDurationGetSecondsGetNano:ERROR",
        "-Xep:JavaDurationWithNanos:ERROR",
        "-Xep:JavaDurationWithSeconds:ERROR",
        "-Xep:JavaInstantGetSecondsGetNano:ERROR",
        "-Xep:JavaLangClash:ERROR",
        "-Xep:JavaLocalDateTimeGetNano:ERROR",
        "-Xep:JavaLocalTimeGetNano:ERROR",
        "-Xep:JavaPeriodGetDays:ERROR",
        "-Xep:JavaTimeDefaultTimeZone:ERROR",
        "-Xep:JavaUtilDate:WARN",
        "-Xep:JdkObsolete:ERROR",
        "-Xep:JodaConstructors:ERROR",
        "-Xep:JodaDateTimeConstants:ERROR",
        "-Xep:JodaDurationWithMillis:ERROR",
        "-Xep:JodaInstantWithMillis:ERROR",
        "-Xep:JodaNewPeriod:ERROR",
        "-Xep:JodaPlusMinusLong:ERROR",
        "-Xep:JodaTimeConverterManager:ERROR",
        "-Xep:JodaToSelf:ERROR",
        "-Xep:JodaWithDurationAddedLong:ERROR",
        "-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR",
        "-Xep:JUnit3TestNotRun:ERROR",
        "-Xep:JUnit4ClassAnnotationNonStatic:ERROR",
        "-Xep:JUnit4ClassUsedInJUnit3:ERROR",
        "-Xep:JUnit4SetUpNotRun:ERROR",
        "-Xep:JUnit4TearDownNotRun:ERROR",
        "-Xep:JUnit4TestNotRun:ERROR",
        "-Xep:JUnit4TestsNotRunWithinEnclosed:ERROR",
        "-Xep:JUnitAmbiguousTestClass:ERROR",
        "-Xep:JUnitAssertSameCheck:ERROR",
        "-Xep:JUnitParameterMethodNotFound:ERROR",
        "-Xep:LiteByteStringUtf8:ERROR",
        "-Xep:LiteEnumValueOf:ERROR",
        "-Xep:LiteProtoToString:ERROR",
        "-Xep:LocalDateTemporalAmount:ERROR",
        "-Xep:LockNotBeforeTry:ERROR",
        "-Xep:LockOnBoxedPrimitive:ERROR",
        "-Xep:LogicalAssignment:ERROR",
        "-Xep:LongFloatConversion:ERROR",
        "-Xep:LongLiteralLowerCaseSuffix:ERROR",
        "-Xep:LoopConditionChecker:ERROR",
        "-Xep:LoopOverCharArray:ERROR",
        "-Xep:LossyPrimitiveCompare:ERROR",
        "-Xep:MathAbsoluteRandom:ERROR",
        "-Xep:MathRoundIntLong:ERROR",
        "-Xep:MemoizeConstantVisitorStateLookups:ERROR",
        "-Xep:MislabeledAndroidString:ERROR",
        "-Xep:MissingCasesInEnumSwitch:ERROR",
        "-Xep:MissingFail:ERROR",
        "-Xep:MissingOverride:ERROR",
        "-Xep:MissingSummary:WARN",
        "-Xep:MissingSuperCall:ERROR",
        "-Xep:MissingTestCall:ERROR",
        "-Xep:MisusedDayOfYear:ERROR",
        "-Xep:MisusedWeekYear:ERROR",
        "-Xep:MixedDescriptors:ERROR",
        "-Xep:MixedMutabilityReturnType:WARN",
        "-Xep:MockitoUsage:ERROR",
        "-Xep:ModifiedButNotUsed:ERROR",
        "-Xep:ModifyCollectionInEnhancedForLoop:ERROR",
        "-Xep:ModifyingCollectionWithItself:ERROR",
        "-Xep:ModifySourceCollectionInStream:ERROR",
        "-Xep:MultipleParallelOrSequentialCalls:ERROR",
        "-Xep:MultipleUnaryOperatorsInMethodCall:ERROR",
        "-Xep:MustBeClosedChecker:ERROR",
        "-Xep:MutableConstantField:ERROR",
        # Java provides no good alternative
        "-Xep:MutablePublicArray:OFF",
        "-Xep:NarrowingCompoundAssignment:ERROR",
        "-Xep:NCopiesOfChar:ERROR",
        "-Xep:NestedInstanceOfConditions:ERROR",
        "-Xep:NonAtomicVolatileUpdate:ERROR",
        "-Xep:NonCanonicalStaticImport:ERROR",
        "-Xep:NonCanonicalType:ERROR",
        "-Xep:NonFinalCompileTimeConstant:ERROR",
        "-Xep:NonOverridingEquals:ERROR",
        "-Xep:NonRuntimeAnnotation:ERROR",
        "-Xep:NullableConstructor:ERROR",
        "-Xep:NullablePrimitive:ERROR",
        "-Xep:NullablePrimitiveArray:ERROR",
        "-Xep:NullableVoid:ERROR",
        "-Xep:NullOptional:ERROR",
        "-Xep:NullTernary:ERROR",
        "-Xep:ObjectEqualsForPrimitives:ERROR",
        "-Xep:ObjectsHashCodePrimitive:ERROR",
        "-Xep:ObjectToString:ERROR",
        "-Xep:OperatorPrecedence:ERROR",
        "-Xep:OptionalEquality:ERROR",
        "-Xep:OptionalMapToOptional:ERROR",
        "-Xep:OptionalMapUnusedValue:ERROR",
        "-Xep:OptionalNotPresent:ERROR",
        "-Xep:OptionalOfRedundantMethod:ERROR",
        "-Xep:OrphanedFormatString:ERROR",
        "-Xep:OutlineNone:ERROR",
        "-Xep:OverlappingQualifierAndScopeAnnotation:ERROR",
        "-Xep:Overrides:ERROR",
        "-Xep:OverridesGuiceInjectableMethod:ERROR",
        "-Xep:OverridesJavaxInjectableMethod:ERROR",
        "-Xep:OverrideThrowableToString:ERROR",
        "-Xep:PackageInfo:ERROR",
        "-Xep:ParameterName:ERROR",
        "-Xep:ParametersButNotParameterized:ERROR",
        "-Xep:ParcelableCreator:ERROR",
        "-Xep:PeriodFrom:ERROR",
        "-Xep:PeriodGetTemporalUnit:ERROR",
        "-Xep:PeriodTimeMath:ERROR",
        "-Xep:PreconditionsCheckNotNullRepeated:ERROR",
        "-Xep:PreconditionsInvalidPlaceholder:ERROR",
        "-Xep:PreferredInterfaceType:OFF",
        "-Xep:PrimitiveAtomicReference:ERROR",
        "-Xep:PrivateSecurityContractProtoAccess:ERROR",
        "-Xep:ProtectedMembersInFinalClass:ERROR",
        "-Xep:ProtoBuilderReturnValueIgnored:ERROR",
        "-Xep:ProtocolBufferOrdinal:ERROR",
        "-Xep:ProtoDurationGetSecondsGetNano:ERROR",
        "-Xep:ProtoFieldNullComparison:ERROR",
        "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",
        "-Xep:ProtoRedundantSet:ERROR",
        "-Xep:ProtoStringFieldReferenceEquality:ERROR",
        "-Xep:ProtoTimestampGetSecondsGetNano:ERROR",
        "-Xep:ProtoTruthMixedDescriptors:ERROR",
        "-Xep:ProvidesMethodOutsideOfModule:ERROR",
        "-Xep:RandomCast:ERROR",
        "-Xep:RandomModInteger:ERROR",
        "-Xep:ReachabilityFenceUsage:ERROR",
        "-Xep:RectIntersectReturnValueIgnored:ERROR",
        "-Xep:ReferenceEquality:ERROR",
        "-Xep:RefersToDaggerCodegen:ERROR",
        "-Xep:RemovedInJDK11:ERROR",
        "-Xep:RequiredModifiers:ERROR",
        "-Xep:RestrictedApiChecker:ERROR",
        "-Xep:RethrowReflectiveOperationExceptionAsLinkageError:ERROR",
        "-Xep:ReturnFromVoid:ERROR",
        "-Xep:ReturnValueIgnored:ERROR",
        "-Xep:RxReturnValueIgnored:ERROR",
        "-Xep:SameNameButDifferent:ERROR",
        "-Xep:SelfAssignment:ERROR",
        "-Xep:SelfComparison:ERROR",
        "-Xep:SelfEquals:ERROR",
        "-Xep:ShortCircuitBoolean:ERROR",
        "-Xep:ShouldHaveEvenArgs:ERROR",
        "-Xep:SizeGreaterThanOrEqualsZero:ERROR",
        "-Xep:StaticAssignmentInConstructor:ERROR",
        "-Xep:StaticGuardedByInstance:ERROR",
        "-Xep:StaticMockMember:ERROR",
        "-Xep:StaticQualifiedUsingExpression:ERROR",
        "-Xep:StreamToString:ERROR",
        "-Xep:StringBuilderInitWithChar:ERROR",
        "-Xep:StringEquality:ERROR",
        "-Xep:StringSplitter:WARN",
        "-Xep:SubstringOfZero:ERROR",
        "-Xep:SuppressWarningsDeprecated:ERROR",
        "-Xep:SwigMemoryLeak:ERROR",
        "-Xep:SynchronizeOnNonFinalField:ERROR",
        "-Xep:TemporalAccessorGetChronoField:ERROR",
        "-Xep:TestParametersNotInitialized:ERROR",
        "-Xep:TheoryButNoTheories:ERROR",
        "-Xep:ThreadJoinLoop:ERROR",
        "-Xep:ThreadLocalUsage:ERROR",
        "-Xep:ThreadPriorityCheck:ERROR",
        "-Xep:ThreeLetterTimeZoneID:WARN",
        "-Xep:ThrowIfUncheckedKnownChecked:ERROR",
        "-Xep:ThrowNull:ERROR",
        "-Xep:TimeUnitConversionChecker:ERROR",
        "-Xep:ToStringReturnsNull:ERROR",
        "-Xep:TreeToString:ERROR",
        "-Xep:TruthAssertExpected:ERROR",
        "-Xep:TruthConstantAsserts:ERROR",
        "-Xep:TruthGetOrDefault:ERROR",
        "-Xep:TruthIncompatibleType:ERROR",
        "-Xep:TruthSelfEquals:ERROR",
        "-Xep:TryFailThrowable:ERROR",
        "-Xep:TypeEquals:ERROR",
        "-Xep:TypeNameShadowing:ERROR",
        "-Xep:TypeParameterQualifier:ERROR",
        "-Xep:TypeParameterShadowing:ERROR",
        "-Xep:TypeParameterUnusedInFormals:ERROR",
        "-Xep:UndefinedEquals:WARN",
        "-Xep:UnescapedEntity:WARN",
        "-Xep:UnnecessaryAssignment:ERROR",
        "-Xep:UnnecessaryCheckNotNull:ERROR",
        "-Xep:UnnecessaryLambda:ERROR",
        "-Xep:UnnecessaryMethodInvocationMatcher:ERROR",
        "-Xep:UnnecessaryMethodReference:ERROR",
        "-Xep:UnnecessaryParentheses:ERROR",
        "-Xep:UnnecessaryTypeArgument:ERROR",
        "-Xep:UnrecognisedJavadocTag:ERROR",
        "-Xep:UnsafeFinalization:ERROR",
        "-Xep:UnsafeReflectiveConstructionCast:ERROR",
        "-Xep:UnsynchronizedOverridesSynchronized:ERROR",
        "-Xep:UnusedAnonymousClass:ERROR",
        "-Xep:UnusedCollectionModifiedInPlace:ERROR",
        "-Xep:UnusedException:ERROR",
        "-Xep:UnusedMethod:WARN",
        "-Xep:UnusedNestedClass:ERROR",
        "-Xep:UnusedVariable:ERROR",
        "-Xep:URLEqualsHashCode:ERROR",
        "-Xep:UseBinds:ERROR",
        "-Xep:UseCorrectAssertInTests:ERROR",
        "-Xep:VariableNameSameAsType:ERROR",
        "-Xep:VarTypeName:ERROR",
        "-Xep:WaitNotInLoop:ERROR",
        "-Xep:WakelockReleasedDangerously:ERROR",
        "-Xep:WildcardImport:ERROR",
        "-Xep:WithSignatureDiscouraged:ERROR",
        "-Xep:WrongOneof:ERROR",
        "-Xep:XorPower:ERROR",
        "-Xep:ZoneIdOfZ:ERROR",
]


exclude_in_tests = ["-Xep:EmptyBlockTag:WARN",
                    "-Xep:MissingSummary:WARN"]

java_package_configuration(
    name = "error_prone",
    javacopts = errorprone_checks,
    packages = ["error_prone_packages"],
)

java_package_configuration(
    name = "error_prone_tests",
    javacopts = [ check for check in errorprone_checks if check not in exclude_in_tests],
    packages = ["error_prone_packages_test"],
)

package_group(
    name = "error_prone_packages",
    packages = [
        "//org.eclipse.jgit.ant/...",
        "//org.eclipse.jgit.archive/...",
        "//org.eclipse.jgit.gpg.bc/...",
        "//org.eclipse.jgit.http.apache/...",
        "//org.eclipse.jgit.http.server/...",
        "//org.eclipse.jgit.junit.ssh/...",
        "//org.eclipse.jgit.junit/...",
        "//org.eclipse.jgit.junit/http/...",
        "//org.eclipse.jgit.lfs.server/...",
        "//org.eclipse.jgit.lfs/...",
        "//org.eclipse.jgit.pgm/...",
        "//org.eclipse.jgit.ssh.apache.agent/...",
        "//org.eclipse.jgit.ssh.apache/...",
        "//org.eclipse.jgit.ssh.jsch/...",
        "//org.eclipse.jgit.ui/...",
        "//org.eclipse.jgit/...",
    ],
)

package_group(
    name = "error_prone_packages_test",
    packages = [
        "//org.eclipse.jgit.ant.test/...",
        "//org.eclipse.jgit.gpg.bc.test/...",
        "//org.eclipse.jgit.http.test/...",
        "//org.eclipse.jgit.lfs.server.test/...",
        "//org.eclipse.jgit.lfs.test/...",
        "//org.eclipse.jgit.pgm.test/...",
        "//org.eclipse.jgit.ssh.apache.test/...",
        "//org.eclipse.jgit.ssh.jsch.test/...",
        "//org.eclipse.jgit.test/...",
    ],
)