Skip to content
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

Automatically configure checkstyle plugin based on gradle build #439

Open
orionlee opened this issue Mar 28, 2019 · 3 comments
Open

Automatically configure checkstyle plugin based on gradle build #439

orionlee opened this issue Mar 28, 2019 · 3 comments

Comments

@orionlee
Copy link

I believe this is essentially the gradle counterpart for #107.

It'd be great if the plugin can honor the existing checkstyle settings in the project gradle build files, at the minimal the checkstyle config files and checkstyle cache.

E.g., configure checkstyle once it recognizes something like the following in the project gradle.

apply plugin: 'checkstyle'

checkstyle {
    configFile = file("${project.rootDir}/config/checkstyle.xml")
configProperties = [
            'checkstyle.cache.file': rootProject.file('build/checkstyle.cache'),
    ]
}

And the android gradle variant (android builds use slightly different config)

apply plugin: 'checkstyle'

task checkstyle(type: Checkstyle) {
    configFile file("${project.rootDir}/config/checkstyle.xml")
    configProperties = [
            'checkstyle.cache.file': rootProject.file('build/checkstyle.cache'),
    ]
// ...
}
@jshiell
Copy link
Owner

jshiell commented Mar 31, 2019

It's a fair request, and probably a useful feature for many people, but it's unlikely to happen, I fear. I haven't used the plugin myself for years, and have just been keeping the lights on. As such, I'm very wary of writing Maven/Gradle/etc integrations and expanding the scope of the plugin even further - Gradle definitely being the scarier option, given the joy of having to parse Kotlin/Groovy, even without supporting all the variants such as Android.

@orionlee
Copy link
Author

@jshiell I appreciate your response nonetheless.

@staffanf
Copy link

If this would be picked up at some point then it should probably use the tooling-api instead of parsing code it self.
My main use case that made me find this issue was that I have started using versioned configs from maven that I resolve to a config file via gradle. Trying to parse something like that form groovy/kotlin would be a lost cause and should not be tried.
But I guess that using the tooling-api would work and probably be easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants