xref: /aosp_15_r20/external/dagger2/java/dagger/lint/DaggerIssueRegistry.kt (revision f585d8a307d0621d6060bd7e80091fdcbf94fe27)
1 /*
2  * Copyright (C) 2020 The Dagger Authors.
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 package dagger.lint
17 
18 import com.android.tools.lint.client.api.IssueRegistry
19 import com.android.tools.lint.client.api.Vendor
20 import com.android.tools.lint.detector.api.CURRENT_API
21 import com.android.tools.lint.detector.api.Issue
22 import com.google.auto.service.AutoService
23 
24 /**
25  * Dagger Lint Issues Registry.
26  *
27  * A META-INF/services entry is added for this class that Lint will discover and call into for
28  * detecting issues.
29  */
30 @AutoService(IssueRegistry::class)
31 @Suppress("unused", "UnstableApiUsage")
32 class DaggerIssueRegistry : IssueRegistry() {
33   // The minApi is set to the Api this registry was compiled with, if a user has an older Api, Lint
34   // will show a warning asking users to upgrade.
35   override val minApi: Int = CURRENT_API
36   // The api is meant to be the current api for which this registry was compiled, but we set a
37   // higher number without depending on a newer Lint to avoid Lint warning users of custom checks
38   // that might not work. This value eventually has to be updated as newer Api become available.
39   override val api: Int = 11
40   override val issues: List<Issue> = DaggerKotlinIssueDetector.issues
41   override val vendor = Vendor(
42     vendorName = "Google",
43     identifier = "com.google.dagger:dagger-lint",
44     feedbackUrl = "https://github.com/google/dagger/issues",
45     contact = "https://github.com/google/dagger"
46   )
47 }
48