Skip to content

Only run specific BugCheckers #174

@kelvinou01

Description

@kelvinou01

Background

We use excavator checks to roll out new BugCheckers, e.g. the gradle-guide has it's own excavator which updates our repositories with suppressions/autofixes of new BugCheckers added by the guide. Sometimes the gradle-guide excavator inadvertently bring in suppressions/autofixes from BugCheckers introduced outside of gradle-guide, e.g. from gradle-baseline.

Intended behavior

We want the gradle-guide excavator to just run BugCheckers from gradle-guide, and nothing else. Having the excavator commit contain only changes from the target BugCheckers lines up with expected behavior, and makes rolling things back/forward easier.

Approaches

By jar

suppressible-error-prone could filter error-prones by the JAR they came from:

gw compileAllErrorProne --source=path/to/gradle-guide-1.0.0.jar

This would involve reading the META-INF/services/com.google.errorprone.bugpatterns.BugChecker file of every included JAR, and finding each checker's canonical name, and enabling only these checkers, perhaps by setting their severity.

Note

BugCheckers are identified by their canonicalName. This may not be the same as the bug checker class name! We'll have to inspect the @BugPattern annotation.

This has the downside of surfacing an implementation detail (JARs) to suppressible-error-prone's API.

By "group"

Maybe we can add the concept of a group to error-prone, to categorize bug checkers:

gw compileAllErrorProne --group="gradle-guide"

Enforcement of groups probably has to be done via more bytecode manipulation, which we are trying to minimize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions