From ba19aa6da02d3252df30cd80399351928c8f883f Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Fri, 13 Oct 2023 23:07:21 +0200 Subject: [PATCH] Rename `TestMethodDetector` to `TestMethodNameDetector` as suggested --- .../samples/apps/nowinandroid/lint/NiaIssueRegistry.kt | 6 +++--- .../{TestMethodDetector.kt => TestMethodNameDetector.kt} | 4 ++-- ...ethodDetectorTest.kt => TestMethodNameDetectorTest.kt} | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) rename lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/{TestMethodDetector.kt => TestMethodNameDetector.kt} (98%) rename lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/{TestMethodDetectorTest.kt => TestMethodNameDetectorTest.kt} (95%) diff --git a/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/NiaIssueRegistry.kt b/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/NiaIssueRegistry.kt index f402b4039..08783dfc3 100644 --- a/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/NiaIssueRegistry.kt +++ b/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/NiaIssueRegistry.kt @@ -25,9 +25,9 @@ class NiaIssueRegistry : IssueRegistry() { override val issues = listOf( DesignSystemDetector.ISSUE, - TestMethodDetector.UNDERSCORE, - TestMethodDetector.FORMAT, - TestMethodDetector.PREFIX, + TestMethodNameDetector.UNDERSCORE, + TestMethodNameDetector.FORMAT, + TestMethodNameDetector.PREFIX, ) override val api: Int = CURRENT_API diff --git a/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodDetector.kt b/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodNameDetector.kt similarity index 98% rename from lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodDetector.kt rename to lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodNameDetector.kt index bcb75ffd5..01791b2d1 100644 --- a/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodDetector.kt +++ b/lint/src/main/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodNameDetector.kt @@ -40,7 +40,7 @@ import kotlin.io.path.Path * - [detectUnderscore] removes underscores in JVM unit test (and add backticks if necessary). * - [detectFormat] Checks the `given_when_then` format of Android instrumented tests (backticks are not supported). */ -class TestMethodDetector : Detector(), SourceCodeScanner { +class TestMethodNameDetector : Detector(), SourceCodeScanner { override fun applicableAnnotations() = listOf("org.junit.Test") @@ -131,7 +131,7 @@ class TestMethodDetector : Detector(), SourceCodeScanner { priority = 5, severity = WARNING, implementation = Implementation( - TestMethodDetector::class.java, + TestMethodNameDetector::class.java, EnumSet.of(JAVA_FILE, TEST_SOURCES), ), ) diff --git a/lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodDetectorTest.kt b/lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodNameDetectorTest.kt similarity index 95% rename from lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodDetectorTest.kt rename to lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodNameDetectorTest.kt index 592b4f8fb..bc84b2b4a 100644 --- a/lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodDetectorTest.kt +++ b/lint/src/test/kotlin/com/google/samples/apps/nowinandroid/lint/TestMethodNameDetectorTest.kt @@ -19,12 +19,12 @@ package com.google.samples.apps.nowinandroid.lint import com.android.tools.lint.checks.infrastructure.TestFile import com.android.tools.lint.checks.infrastructure.TestFiles.kotlin import com.android.tools.lint.checks.infrastructure.TestLintTask.lint -import com.google.samples.apps.nowinandroid.lint.TestMethodDetector.Companion.FORMAT -import com.google.samples.apps.nowinandroid.lint.TestMethodDetector.Companion.PREFIX -import com.google.samples.apps.nowinandroid.lint.TestMethodDetector.Companion.UNDERSCORE +import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.FORMAT +import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.PREFIX +import com.google.samples.apps.nowinandroid.lint.TestMethodNameDetector.Companion.UNDERSCORE import org.junit.Test -class TestMethodDetectorTest { +class TestMethodNameDetectorTest { @Test fun `detect prefix`() {