diff options
author | Kevin Jeon <kevinjeon@google.com> | 2021-07-22 22:46:01 +0000 |
---|---|---|
committer | Kevin Jeon <kevinjeon@google.com> | 2021-07-28 16:20:11 +0000 |
commit | cb4d8ae3a911f1dec89aef05feb2d0df6812f893 (patch) | |
tree | 218d30a8ef782f5bd57e6fc972ca853f33b4ab88 /lint/src | |
parent | c98691eaf2be83cf64d3673cf93c8263d7aecaa0 (diff) | |
download | idea-cb4d8ae3a911f1dec89aef05feb2d0df6812f893.tar.gz |
Register lint check for @Discouraged
This change registers the lint check that flags on the usage of APIs
annotated with @Discouraged.
Bug: 178477913
Test: - Presubmit
- Change was auto-generated by LintInspectionRegistrationTest.kt
Change-Id: I34c9ffe5cdf8f4db4b5d19c2050746e09aac45e1
Diffstat (limited to 'lint/src')
-rw-r--r-- | lint/src/META-INF/lint-plugin.xml | 1 | ||||
-rw-r--r-- | lint/src/com/android/tools/idea/lint/common/AndroidLintDiscouragedApiInspection.kt | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/lint/src/META-INF/lint-plugin.xml b/lint/src/META-INF/lint-plugin.xml index bd574b98088..0520451013e 100644 --- a/lint/src/META-INF/lint-plugin.xml +++ b/lint/src/META-INF/lint-plugin.xml @@ -39,6 +39,7 @@ <globalInspection hasStaticDescription="true" shortName="AndroidLintBadHostnameVerifier" displayName="Insecure HostnameVerifier" bundle="messages.LintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintBadHostnameVerifierInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintCheckResult" displayName="Ignoring results" bundle="messages.LintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintCheckResultInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintDefaultLocale" displayName="Implied default locale in case conversion" bundle="messages.LintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintDefaultLocaleInspection"/> + <globalInspection hasStaticDescription="true" shortName="AndroidLintDiscouragedApi" displayName="Using discouraged APIs" bundle="messages.LintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintDiscouragedApiInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintEasterEgg" displayName="Code contains easter egg" bundle="messages.LintBundle" enabledByDefault="false" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintEasterEggInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintExpensiveAssertion" displayName="Expensive Assertions" bundle="messages.LintBundle" enabledByDefault="false" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintExpensiveAssertionInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintFileEndsWithExt" displayName="File endsWith on file extensions" bundle="messages.LintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.common.AndroidLintFileEndsWithExtInspection"/> diff --git a/lint/src/com/android/tools/idea/lint/common/AndroidLintDiscouragedApiInspection.kt b/lint/src/com/android/tools/idea/lint/common/AndroidLintDiscouragedApiInspection.kt new file mode 100644 index 00000000000..fad8bd2691f --- /dev/null +++ b/lint/src/com/android/tools/idea/lint/common/AndroidLintDiscouragedApiInspection.kt @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.tools.idea.lint.common + +import com.android.tools.idea.lint.common.LintBundle.Companion.message +import com.android.tools.lint.checks.DiscouragedDetector + +class AndroidLintDiscouragedApiInspection : AndroidLintInspectionBase( + message("android.lint.inspections.discouraged.api"), DiscouragedDetector.ISSUE +) |