Checkstyle with subprojects fail at end of all tests not on first error


(Ryan McLaughlin) #1

I am using checkstyle with gradle and as far as I can tell the default behaviour is to exit after the first failure. So I added ‘ignoreFailures = true’ so that it will complete all tests. However, when the tests are complete I would still like it to fail so the CI system will not continue. Is there any way to do this in gradle?

subprojects {
    apply plugin: 'findbugs'
    apply plugin: 'checkstyle'

    findbugs {
        ignoreFailures = true
    }

    tasks.withType(FindBugs) {
        reports {
            xml.enabled = false
            html.enabled = true
            html {
                destination file("${rootProject.projectDir}/reports/findbugs/${project.name}.html")
            }
        }
    }

    checkstyle {
        ignoreFailures = true
        showViolations = false
        configDir = file("${rootProject.projectDir}/config/checkstyle")
        configFile = file("${configDir}/checkstyle.xml")
        configProperties = [
                'configDir': configDir,
                'baseDir'  : rootDir,
        ]
    }

    tasks.withType(Checkstyle) {
        reports {
            xml.enabled = false
            html.enabled = true
            html {
                destination file("${rootProject.projectDir}/reports/checkstyle/${project.name}.html")
            }
        }
    }
}

(Stefan Wolf) #2

How about using --continue instead of ignoreFailure. IIUC, that should do what you want.


(Ryan McLaughlin) #3

Thanks for the reply, that worked great