summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/checks/src/com/android/internal/systemui/lint/DemotingTestWithoutBugDetector.kt7
-rw-r--r--packages/SystemUI/checks/tests/com/android/internal/systemui/lint/DemotingTestWithoutBugDetectorTest.kt10
2 files changed, 10 insertions, 7 deletions
diff --git a/packages/SystemUI/checks/src/com/android/internal/systemui/lint/DemotingTestWithoutBugDetector.kt b/packages/SystemUI/checks/src/com/android/internal/systemui/lint/DemotingTestWithoutBugDetector.kt
index 09762b04e6a9..2fc56c97f124 100644
--- a/packages/SystemUI/checks/src/com/android/internal/systemui/lint/DemotingTestWithoutBugDetector.kt
+++ b/packages/SystemUI/checks/src/com/android/internal/systemui/lint/DemotingTestWithoutBugDetector.kt
@@ -43,7 +43,9 @@ class DemotingTestWithoutBugDetector : Detector(), SourceCodeScanner {
if (node.qualifiedName in DEMOTING_ANNOTATION_BUG_ID) {
if (!containsBugId(node)) {
val location = context.getLocation(node)
- val message = "Please attach a bug id to track demoted test"
+ val message =
+ """Please attach a bug id to track demoted test, """ +
+ """e.g. @FlakyTest(bugId = 123)"""
context.report(ISSUE, node, location, message)
}
}
@@ -51,7 +53,8 @@ class DemotingTestWithoutBugDetector : Detector(), SourceCodeScanner {
if (node.qualifiedName == DEMOTING_ANNOTATION_IGNORE) {
if (!containsBugString(node)) {
val location = context.getLocation(node)
- val message = "Please attach a bug (e.g. b/123) to track demoted test"
+ val message =
+ """Please attach a bug to track demoted test, e.g. @Ignore("b/123")"""
context.report(ISSUE, node, location, message)
}
}
diff --git a/packages/SystemUI/checks/tests/com/android/internal/systemui/lint/DemotingTestWithoutBugDetectorTest.kt b/packages/SystemUI/checks/tests/com/android/internal/systemui/lint/DemotingTestWithoutBugDetectorTest.kt
index a1e6f92a7218..ee6e0ce72713 100644
--- a/packages/SystemUI/checks/tests/com/android/internal/systemui/lint/DemotingTestWithoutBugDetectorTest.kt
+++ b/packages/SystemUI/checks/tests/com/android/internal/systemui/lint/DemotingTestWithoutBugDetectorTest.kt
@@ -98,7 +98,7 @@ class DemotingTestWithoutBugDetectorTest : SystemUILintDetectorTest() {
.run()
.expect(
"""
- src/test/pkg/TestClass.java:4: Warning: Please attach a bug id to track demoted test [DemotingTestWithoutBug]
+ src/test/pkg/TestClass.java:4: Warning: Please attach a bug id to track demoted test, e.g. @FlakyTest(bugId = 123) [DemotingTestWithoutBug]
@FlakyTest
~~~~~~~~~~
0 errors, 1 warnings
@@ -126,7 +126,7 @@ class DemotingTestWithoutBugDetectorTest : SystemUILintDetectorTest() {
.run()
.expect(
"""
- src/test/pkg/TestClass.java:4: Warning: Please attach a bug id to track demoted test [DemotingTestWithoutBug]
+ src/test/pkg/TestClass.java:4: Warning: Please attach a bug id to track demoted test, e.g. @FlakyTest(bugId = 123) [DemotingTestWithoutBug]
@FlakyTest
~~~~~~~~~~
0 errors, 1 warnings
@@ -181,7 +181,7 @@ class DemotingTestWithoutBugDetectorTest : SystemUILintDetectorTest() {
.run()
.expect(
"""
- src/test/pkg/TestClass.java:4: Warning: Please attach a bug id to track demoted test [DemotingTestWithoutBug]
+ src/test/pkg/TestClass.java:4: Warning: Please attach a bug id to track demoted test, e.g. @FlakyTest(bugId = 123) [DemotingTestWithoutBug]
@Platinum(devices = "foo,bar")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 errors, 1 warnings
@@ -236,7 +236,7 @@ class DemotingTestWithoutBugDetectorTest : SystemUILintDetectorTest() {
.run()
.expect(
"""
- src/test/pkg/TestClass.java:4: Warning: Please attach a bug (e.g. b/123) to track demoted test [DemotingTestWithoutBug]
+ src/test/pkg/TestClass.java:4: Warning: Please attach a bug to track demoted test, e.g. @Ignore("b/123") [DemotingTestWithoutBug]
@Ignore
~~~~~~~
0 errors, 1 warnings
@@ -264,7 +264,7 @@ class DemotingTestWithoutBugDetectorTest : SystemUILintDetectorTest() {
.run()
.expect(
"""
- src/test/pkg/TestClass.java:4: Warning: Please attach a bug (e.g. b/123) to track demoted test [DemotingTestWithoutBug]
+ src/test/pkg/TestClass.java:4: Warning: Please attach a bug to track demoted test, e.g. @Ignore("b/123") [DemotingTestWithoutBug]
@Ignore("Not ready")
~~~~~~~~~~~~~~~~~~~~
0 errors, 1 warnings