Skip to content

Enable auto discovery of Checkstyle config file via gradle plugin  #338

@blipper

Description

@blipper

What problem are you trying to solve?

Easy of configuration for initial users

Describe the solution you'd like

private List<NamedStyles> getStyles() {
if (styles == null) {
styles = environment().activateStyles(getActiveStyles());
File checkstyleConfig = extension.getCheckstyleConfigFile();
if (checkstyleConfig != null && checkstyleConfig.exists()) {
try {
styles.add(CheckstyleConfigLoader.loadCheckstyleConfig(checkstyleConfig.toPath(), extension.getCheckstyleProperties()));
} catch (Exception e) {
logger.warn("Unable to parse Checkstyle configuration", e);
}
}
}
return styles;
}
has the code to load checkfile config files.

It would be great if the plugin could A) detect if the checkstyle plugin was loaded
B) at task execution time us the configFile value automatically from https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.CheckstyleExtension.html#org.gradle.api.plugins.quality.CheckstyleExtension:configFile

Have you considered any alternatives or workarounds?

You can manually configure this but non-obvious.

Additional context

Are you interested in contributing this feature to OpenRewrite?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions