diff --git a/slack-lint-checks/src/main/java/slack/lint/DoNotCallProvidersDetector.kt b/slack-lint-checks/src/main/java/slack/lint/DoNotCallProvidersDetector.kt index ba495fef..ed951c4a 100644 --- a/slack-lint-checks/src/main/java/slack/lint/DoNotCallProvidersDetector.kt +++ b/slack-lint-checks/src/main/java/slack/lint/DoNotCallProvidersDetector.kt @@ -5,36 +5,21 @@ package slack.lint import com.android.tools.lint.client.api.UElementHandler import com.android.tools.lint.detector.api.Category import com.android.tools.lint.detector.api.Detector -import com.android.tools.lint.detector.api.Implementation import com.android.tools.lint.detector.api.Issue import com.android.tools.lint.detector.api.JavaContext -import com.android.tools.lint.detector.api.Scope import com.android.tools.lint.detector.api.Severity import com.android.tools.lint.detector.api.SourceCodeScanner import com.android.tools.lint.detector.api.TextFormat -import java.util.EnumSet import org.jetbrains.uast.UCallExpression import org.jetbrains.uast.UClass import org.jetbrains.uast.getParentOfType +import slack.lint.util.sourceImplementation -@Suppress("UnstableApiUsage") class DoNotCallProvidersDetector : Detector(), SourceCodeScanner { companion object { - // We use the overloaded constructor that takes a varargs of `Scope` as the last param. - // This is to enable on-the-fly IDE checks. We are telling lint to run on both - // JAVA and TEST_SOURCES in the `scope` parameter but by providing the `analysisScopes` - // params, we're indicating that this check can run on either JAVA or TEST_SOURCES and - // doesn't require both of them together. - // From discussion on lint-dev https://groups.google.com/d/msg/lint-dev/ULQMzW1ZlP0/1dG4Vj3-AQAJ - // This was supposed to be fixed in AS 3.4 but still required as recently as 3.6-alpha10. private val SCOPES = - Implementation( - DoNotCallProvidersDetector::class.java, - EnumSet.of(Scope.JAVA_FILE, Scope.TEST_SOURCES), - EnumSet.of(Scope.JAVA_FILE), - EnumSet.of(Scope.TEST_SOURCES), - ) + sourceImplementation(shouldRunOnTestSources = false) val ISSUE: Issue = Issue.create(