-
Notifications
You must be signed in to change notification settings - Fork 89
Excluding Rules
You may exclude a rule or set of rules from consideration either with a gradle property gradleLint.excludedRules
or through the extension property of the same name.
This is useful when you want to include a rule group that bundles a set of rules together, but you wish to ignore one or more of the rules in the group:
gradleLint {
rules = ['all-dependency']
// if we don't want this rule to run which is in the all-dependency group...
excludedRules = ['unused-dependency']
}
This can also be useful when you want to exclude a rule from running in CI stages or other mass validation workflows where you can inject Gradle properties via the command line, especially if the rule to exclude is configured as a critical rule and may fail the build because of lint. Suppose we have the following critical rule set configured in our build, which would fail the build if there are any unused dependencies (among other things):
gradleLint.criticalRules = ['all-dependency']
If we have a CI stage or other batch process that we want to use to exercise the build but not fail on unused dependencies, we could add a command line property to override what it is in the build file:
./gradlew build -PgradleLint.exclude=unused-dependency