Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Check Kotlin suppression comments

Manav Rathi6aead3a64cb9
diff --git a/android/checks/lint-exceptions/parse.gradle b/android/checks/lint-exceptions/parse.gradle
index d6fdb36096..edaa114017 100644
--- a/android/checks/lint-exceptions/parse.gradle
+++ b/android/checks/lint-exceptions/parse.gradle
@@ -115,7 +115,7 @@ gradle.rootProject { project ->
}
}
}
- PsiTreeUtil.collectElementsOfType(file, PsiComment).each { comment ->
+ SyntaxTraverser.psiTraverser(file).filter(PsiComment).each { comment ->
def match = comment.text =~ /\bnoinspection\b([^\r\n]*)/
if (match.find()) {
record(comment.textOffset,
diff --git a/android/checks/lint-exceptions/test.mjs b/android/checks/lint-exceptions/test.mjs
index 74cd2b8678..1442fd3458 100644
--- a/android/checks/lint-exceptions/test.mjs
+++ b/android/checks/lint-exceptions/test.mjs
@@ -19,6 +19,7 @@ const suppressions = [
'import kotlin.Suppress as Quiet\n@Quiet("NewApi") fun example() {}',
],
["kt", 'val text = """${run {\n@Suppress("NewApi")\noldMethod()\n}}"""'],
+ ["kt", "//noinspection NewApi\nfun example() {}"],
["java", '@android.annotation.SuppressLint("NewApi") class Example {}'],
["java", '@SuppressWarnings(value = {"NewApi"}) class Example {}'],
["java", "//noinspection NewApi\nclass Example {}"],