I am setting up Checkstyle using Gradle in a multiproject configuration and would like to configure a maximum number of code violations.
With Maven builds and the checkstyle plugin this was possible via the user property ‘checkstyle.maxAllowedViolations’ as per the following advice.
Below is a snippet of my checkstyle block (not working):
checkstyle {
toolVersion = ‘7.+’
logger.info “$project using Checkstyle version $toolVersion.”
copy { from zipTree(configurations.checkstyleConfig.singleFile) into("${project.buildDir}") }
def configFile = file("${project.buildDir}/config/checkstyle/mycompany-checkstyle.xml") config = resources.text.fromFile(configFile) logger.info "$project using Checkstyle configuration from: ${configFile}"
def suppressionsFile = file("${project.buildDir}/config/checkstyle/mycompany-suppressions.xml") logger.info "$project using Checkstyle suppressions from: ${suppressionsFile}"
def headerFile = file("${project.buildDir}/config/checkstyle/mycompany.header") logger.info "$project using Checkstyle header from: ${headerFile}"
configProperties = [ 'checkstyle.header.file': headerFile, 'checkstyle.suppressions.file': suppressionsFile, 'checkstyle.maxAllowedViolations': 2316 // DOES NOT WORK ]
//configProperties.maxAllowedViolations = 2316
}
Can anyone suggest what property to set?