1// Copyright 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Set of error prone rules to ensure code quality
16// PackageLocation check requires the androidCompatible=false otherwise it does not do anything.
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21java_defaults {
22  name: "tradefed_errorprone_defaults",
23  errorprone: {
24    javacflags: [
25      "-XDandroidCompatible=false",
26      "-Xep:ArrayToString:ERROR",
27      "-Xep:BoxedPrimitiveConstructor:ERROR",
28      "-Xep:CatchFail:ERROR",
29      "-Xep:ConstantField:ERROR",
30      "-Xep:DeadException:ERROR",
31      "-Xep:EqualsIncompatibleType:ERROR",
32      "-Xep:ExtendingJUnitAssert:ERROR",
33      "-Xep:FallThrough:ERROR",
34      "-Xep:FormatString:ERROR",
35      "-Xep:GetClassOnClass:ERROR",
36      "-Xep:IdentityBinaryExpression:ERROR",
37      "-Xep:JUnit3TestNotRun:ERROR",
38      "-Xep:JUnit4TestNotRun:ERROR",
39      "-Xep:JUnit4ClassUsedInJUnit3:ERROR",
40      "-Xep:JUnitAmbiguousTestClass:ERROR",
41      "-Xep:LongLiteralLowerCaseSuffix:ERROR",
42      "-Xep:MissingCasesInEnumSwitch:ERROR",
43      "-Xep:MissingFail:ERROR",
44      "-Xep:MissingOverride:ERROR",
45      "-Xep:ModifiedButNotUsed:ERROR",
46      "-Xep:MustBeClosedChecker:ERROR",
47      "-Xep:Overrides:ERROR",
48      "-Xep:PackageLocation:ERROR",
49      "-Xep:ParameterName:ERROR",
50      "-Xep:ReferenceEquality:ERROR",
51      "-Xep:RemoveUnusedImports:ERROR",
52      "-Xep:ReturnValueIgnored:ERROR",
53      "-Xep:SelfEquals:ERROR",
54      "-Xep:SizeGreaterThanOrEqualsZero:ERROR",
55      "-Xep:StreamResourceLeak:ERROR",
56      "-Xep:TryFailThrowable:ERROR",
57      "-Xep:UnnecessaryParentheses:ERROR",
58      "-Xep:UseCorrectAssertInTests:ERROR",
59      "-XepDisableWarningsInGeneratedCode",  // Disable warnings in gRPC generated code.
60      "-XepExcludedPaths:.*/srcjars/.*"
61    ],
62  },
63}
64
65java_defaults {
66  name: "tradefed_defaults",
67  defaults: [ "tradefed_errorprone_defaults" ],
68  javacflags: [
69    "-g",
70    "-Xlint",
71  ],
72}
73