Skip to content

Allow SpringHeaderCheck to load custom files #70

Closed
@vpavic

Description

@vpavic

Currently, SpringHeaderCheck loads header file from the same package:

String name = "header-" + type + ".txt";
InputStream inputStream = SpringHeaderCheck.class.getResourceAsStream(name);

Unless I'm missing something, this makes it difficult to use a custom header as it requires users to place the custom header in io/spring/javaformat/checkstyle/check package on their Checkstyle classpath. It would be nice if SpringHeaderCheck would load the custom header from the root of Checkstyle classpath.

To clarify, assuming a Gradle build with default Checkstyle config location of config/checkstyle one need to do the following:

checkstyle {
    toolVersion = '8.12'
    // other config...
}

tasks.withType(Checkstyle) {
    checkstyleClasspath += files('config/checkstyle')
}

And then place the custom header file in config/checkstyle/io/spring/javaformat/checkstyle/check while the desirable would be to simply place it in config/checkstyle.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions