Skip to content

Allow SpringHeaderCheck to load custom files #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vpavic opened this issue Oct 4, 2018 · 2 comments
Closed

Allow SpringHeaderCheck to load custom files #70

vpavic opened this issue Oct 4, 2018 · 2 comments

Comments

@vpavic
Copy link
Contributor

vpavic commented Oct 4, 2018

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.

@philwebb philwebb added this to the 0.0.7 milestone Oct 4, 2018
@philwebb
Copy link
Contributor

philwebb commented Oct 4, 2018

Good idea!

@philwebb philwebb modified the milestones: 0.0.7, 0.0.8, 0.0.x Mar 26, 2019
@philwebb
Copy link
Contributor

Actually, on review the file isn't really designed to be replaced in that way. It's working by accident currently. I think it would be better if you could specify an external file directly and we ignore the type attribute.

@philwebb philwebb changed the title Consider making SpringHeaderCheck easier to customize Allow SpringHeaderCheck to load custom files Mar 30, 2019
@philwebb philwebb modified the milestones: 0.0.x, 0.0.8 Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants