diff options
author | Kevin Jeon <kevinjeon@google.com> | 2021-11-04 18:26:49 +0000 |
---|---|---|
committer | Kevin Jeon <kevinjeon@google.com> | 2021-12-13 23:12:28 +0000 |
commit | 962b848e5c6e2d787886142d3cd8ba8cd9c152b0 (patch) | |
tree | f5cb598ca8bcd54ec6daf6f765b3746f102f0d65 /android-lint/src | |
parent | 12b4d097e208d17009a90c4d814a88e460c1f66d (diff) | |
download | idea-962b848e5c6e2d787886142d3cd8ba8cd9c152b0.tar.gz |
Register lint check for trivial format strings
This change registers the corresponding lint check in tools/base.
Test: presubmit
Bug: 202993567
Change-Id: I9c43caed0c58a2b6c0dd6fd59fead344866f2677
Diffstat (limited to 'android-lint/src')
-rw-r--r-- | android-lint/src/META-INF/android-lint-plugin.xml | 1 | ||||
-rw-r--r-- | android-lint/src/com/android/tools/idea/lint/inspections/AndroidLintStringFormatTrivialInspection.kt | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/android-lint/src/META-INF/android-lint-plugin.xml b/android-lint/src/META-INF/android-lint-plugin.xml index 6a8166ae275..e7f641d7c22 100644 --- a/android-lint/src/META-INF/android-lint-plugin.xml +++ b/android-lint/src/META-INF/android-lint-plugin.xml @@ -282,6 +282,7 @@ <globalInspection hasStaticDescription="true" shortName="AndroidLintStringFormatCount" displayName="Formatting argument types incomplete or inconsistent" bundle="messages.AndroidLintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintStringFormatCountInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintStringFormatInvalid" displayName="Invalid format string" bundle="messages.AndroidLintBundle" enabledByDefault="true" level="ERROR" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintStringFormatInvalidInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintStringFormatMatches" displayName="String.format string doesn't match the XML format string" bundle="messages.AndroidLintBundle" enabledByDefault="true" level="ERROR" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintStringFormatMatchesInspection"/> + <globalInspection hasStaticDescription="true" shortName="AndroidLintStringFormatTrivial" displayName="String.format string only contains trivial conversions" bundle="messages.AndroidLintBundle" enabledByDefault="false" level="WARNING" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintStringFormatTrivialInspection"/>A <globalInspection hasStaticDescription="true" shortName="AndroidLintStringShouldBeInt" displayName="String should be int" bundle="messages.AndroidLintBundle" enabledByDefault="true" level="ERROR" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintStringShouldBeIntInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintSuspicious0dp" displayName="Suspicious 0dp dimension" bundle="messages.AndroidLintBundle" enabledByDefault="true" level="ERROR" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintSuspicious0dpInspection"/> <globalInspection hasStaticDescription="true" shortName="AndroidLintSuspiciousImport" displayName="'import android.R' statement" bundle="messages.AndroidLintBundle" enabledByDefault="true" level="WARNING" implementationClass="com.android.tools.idea.lint.inspections.AndroidLintSuspiciousImportInspection"/> diff --git a/android-lint/src/com/android/tools/idea/lint/inspections/AndroidLintStringFormatTrivialInspection.kt b/android-lint/src/com/android/tools/idea/lint/inspections/AndroidLintStringFormatTrivialInspection.kt new file mode 100644 index 00000000000..2916442edd1 --- /dev/null +++ b/android-lint/src/com/android/tools/idea/lint/inspections/AndroidLintStringFormatTrivialInspection.kt @@ -0,0 +1,24 @@ +/* + * 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.inspections + +import com.android.tools.idea.lint.common.AndroidLintInspectionBase +import com.android.tools.lint.checks.StringFormatDetector +import com.android.tools.idea.lint.AndroidLintBundle.Companion.message + +class AndroidLintStringFormatTrivialInspection : AndroidLintInspectionBase( + message("android.lint.inspections.string.format.trivial"), StringFormatDetector.TRIVIAL +) |