1 /*
2  * Copyright 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 @file:Suppress("UnstableApiUsage")
18 
19 package androidx.build.lint
20 
21 import com.android.tools.lint.client.api.IssueRegistry
22 import com.android.tools.lint.client.api.Vendor
23 import com.android.tools.lint.detector.api.CURRENT_API
24 import com.android.tools.lint.detector.api.Issue
25 
26 class AndroidXIssueRegistry : IssueRegistry() {
27     override val minApi = CURRENT_API
28     override val api = 16
29     override val issues
30         get(): List<Issue> {
31             return Issues
32         }
33 
34     override val vendor =
35         Vendor(
36             feedbackUrl = "https://issuetracker.google.com/issues/new?component=1147525",
37             identifier = "androidx.build",
38             vendorName = "Android Open Source Project",
39         )
40 
41     companion object {
42         val Issues
43             get(): List<Issue> {
44                 return listOf(
45                     AndroidManifestServiceExportedDetector.ISSUE,
46                     BanParcelableUsage.ISSUE,
47                     BanConcurrentHashMap.ISSUE,
48                     BanVisibilityDocTags.HIDE_ISSUE,
49                     BanVisibilityDocTags.SUPPRESS_ISSUE,
50                     BanVisibilityDocTags.REMOVED_ISSUE,
51                     BanInappropriateExperimentalUsage.ISSUE,
52                     BanInappropriateExperimentalUsage.NULL_ANNOTATION_GROUP_ISSUE,
53                     BanInlineOptIn.ISSUE,
54                     BanKeepAnnotation.ISSUE,
55                     BanThreadSleep.ISSUE,
56                     TargetApiAnnotationUsageDetector.ISSUE,
57                     // If you add more SampledAnnotationDetector issues here, you
58                     // MUST also update `buildSrc/lint_samples.xml` to ensure they
59                     // run against samples projects.
60                     SampledAnnotationDetector.OBSOLETE_SAMPLED_ANNOTATION,
61                     SampledAnnotationDetector.UNRESOLVED_SAMPLE_LINK,
62                     SampledAnnotationDetector.MULTIPLE_FUNCTIONS_FOUND,
63                     SampledAnnotationDetector.INVALID_SAMPLES_LOCATION,
64                     TestSizeAnnotationEnforcer.UNEXPECTED_TEST_SIZE_ANNOTATION,
65                     BanUncheckedReflection.ISSUE,
66                     ObsoleteBuildCompatUsageDetector.ISSUE,
67                     BanSynchronizedMethods.ISSUE,
68                     MetadataTagInsideApplicationTagDetector.ISSUE,
69                     PrivateConstructorForUtilityClassDetector.ISSUE,
70                     IdeaSuppressionDetector.ISSUE,
71                     CameraXQuirksClassDetector.ISSUE,
72                     IgnoreClassLevelDetector.ISSUE,
73                     ExperimentalPropertyAnnotationDetector.ISSUE,
74                     BanRestrictToTestsScope.ISSUE,
75                     // MissingJvmDefaultWithCompatibilityDetector is intentionally left out of the
76                     // registry, see comments on the class for more details.
77                     BanVisibleForTestingParams.ISSUE,
78                     PrereleaseSdkCoreDependencyDetector.ISSUE,
79                     DeprecationMismatchDetector.ISSUE,
80                     RestrictToDetector.RESTRICTED,
81                     ObsoleteCompatDetector.ISSUE,
82                     ReplaceWithDetector.ISSUE,
83                     // This issue is only enabled when `-Pandroidx.useJSpecifyAnnotations=true`.
84                     JSpecifyNullnessMigration.ISSUE,
85                     TypeMirrorToString.ISSUE,
86                     BanNullMarked.ISSUE,
87                     AutoValueNullnessOverride.ISSUE,
88                     FlaggedApiDetector.ISSUE,
89                 )
90             }
91     }
92 }
93