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

checkstyle not being parsed #10

Closed
kfot opened this issue Jan 17, 2019 · 1 comment
Closed

checkstyle not being parsed #10

kfot opened this issue Jan 17, 2019 · 1 comment
Labels

Comments

@kfot
Copy link

kfot commented Jan 17, 2019

First of all - thanks for the great plugin.

Issue: checkstyle report results not included in violations summary because the parser not respects the non-default configFile dir.

I'm using default checkstyle gradle plugin with a multi-module Java 11 project, Gradle 5.1.1

$ ./gradlew violations -d shows that these dirs are being checked

15:44:09.560 [DEBUG] [ViolationsApi] /work/.gradle/daemon/5.1.1/./checkstyle/checkstyle.xml
15:44:09.560 [DEBUG] [ViolationsApi] /work/.gradle/daemon/5.1.1/./config/checkstyle/checkstyle.xml
15:44:09.561 [DEBUG] [ViolationsApi] Found 0 violations:

despite such checkstyle settings from build.gradle

    checkstyle {
        toolVersion = "8.16"
        ignoreFailures = true
        showViolations = true
        configFile = new File(rootDir, "checkstyle/checkstyle.xml")
//        reportsDir = new File(project.buildDir, "reports/checkstyle") <- explicit setting did not change anything
    }

In fact, checkstyle reports are within the dafault path ( next to pmd and spotbugs reports which work fine)

my-multi-module-project/hello-world/build/reports/checkstyle/main.xml

and my regex is as in your example (as I mentioned, it works for pmd and spotbugs but not for checkstyle)

        violations = [
                ["FINDBUGS",   ".",  ".*/spotbugs/.*\\.xml\$",  "Spotbugs"],
                ["PMD",        ".",  ".*/pmd/.*\\.xml\$",       "PMD"],
                ["CHECKSTYLE", ".",  ".*/checkstyle/*\\.xml\$", "Checkstyle"],
        ]
@tomasbjerre
Copy link
Owner

The plugin searches a folder that is pointed out with . in your example.

Here: https://github.com/tomasbjerre/violations-gradle-plugin/blob/master/src/main/java/se/bjurr/violations/gradle/plugin/ViolationsTask.java#L212

And in the lib: https://github.com/tomasbjerre/violations-lib/blob/50bcfaaf1afdbdd8c456a283e2f7fb4530720f7b/src/main/java/se/bjurr/violations/lib/ViolationsApi.java#L39

Perhaps try:

        violations = [
                ["FINDBUGS",   project.buildDir,  ".*/spotbugs/.*\\.xml\$",  "Spotbugs"],
                ["PMD",        project.buildDir,  ".*/pmd/.*\\.xml\$",       "PMD"],
                ["CHECKSTYLE", project.buildDir,  ".*/checkstyle/*\\.xml\$", "Checkstyle"],
        ]

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

No branches or pull requests

2 participants