Configure detectors to only run when the Lint client is Gradle but not Android Studio.

68 views
Skip to first unread message

kiran puppala

unread,
Sep 7, 2021, 10:06:06 AM9/7/21
to lint-dev
Hi Tor, 
We want few detectors to run only when Gradle lint task is executed but should not run from Android Studio. 
We want to execute some detectors only when the Lint client is Gradle. I know we can do that by checking the client while writing detector logic using this method LintClient.isGradle().

We would like to know if there's a more robust way of doing this instead of making this check everywhere inside detectors. Can we exclude few detectors in the Issue Registry based on the Lint client?

Example: 

class CustomIssueRegistry : IssueRegistry() {
override val issues: List<Issue>
      get() = if (LintClient.isGradle) {
                       gradleOnlyIssueList
                  } else {
                       studioOnlyIssueList
                  }
 }
Reply all
Reply to author
Forward
0 new messages