{"record":{"id":"919aa7b9a7fc4593","repo":"gradle/gradle","slug":"checkstyle-rule-violations-were-found-see-the-rep","errorCode":null,"errorMessage":"Checkstyle rule violations were found. See the report at: {}","messagePattern":"Checkstyle rule violations were found\\. See the report at: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"platforms/jvm/code-quality-workers/src/main/java/org/gradle/api/plugins/quality/internal/CheckstyleInvoker.java","lineNumber":179,"sourceCode":"                ant.createNode(\"param\", ImmutableMap.of(\"name\", \"gradleVersion\", \"expression\", GradleVersion.current().toString()));\n                ant.createNode(\"style\", Collections.emptyMap(), () ->\n                    ant.createNode(\"string\", ImmutableMap.of(\"value\", stylesheet))\n                );\n            });\n        }\n\n        if (isHtmlReportEnabledOnly(isXmlRequired, isHtmlRequired)) {\n            GFileUtils.deleteQuietly(xmlOutputLocation);\n        }\n\n        Node reportXml = parseCheckstyleXml(isXmlRequired, xmlOutputLocation);\n        String message = getMessage(isXmlRequired, xmlOutputLocation, isHtmlRequired, htmlOutputLocation, isSarifRequired, sarifOutputLocation, reportXml);\n        boolean hasAFailure = ant.getProjectProperties().get(FAILURE_PROPERTY_NAME) != null;\n        if (hasAFailure && !ignoreFailures) {\n            throw new MarkedVerificationException(message);\n        } else {\n            if (violationsExist(reportXml)) {\n                LOGGER.warn(message);\n            }\n        }\n    }\n\n    @Nullable\n    private static File getXmlOutputLocation(CheckstyleActionParameters parameters, boolean isXmlRequired, boolean isHtmlRequired) {\n        File xmlOutputLocation = parameters.getXmlOutputLocation().getAsFile().getOrNull();\n        if (isHtmlReportEnabledOnly(isXmlRequired, isHtmlRequired)) {\n            checkNotNull(xmlOutputLocation, \"Xml report output location is required when html report is requested.\");\n            return new File(parameters.getTemporaryDir().getAsFile().get(), xmlOutputLocation.getName());\n        }\n        return xmlOutputLocation;\n    }\n\n    private static JavaVersion determineCheckstyleJavaVersion(ClassLoader antLoader) {\n        InputStream checkstyleTask = antLoader.getResourceAsStream(\"com/puppycrawl/tools/checkstyle/CheckStyleTask.class\");\n        if (checkstyleTask == null) {\n            checkstyleTask = antLoader.getResourceAsStream(\"com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.class\");","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/jvm/code-quality-workers/src/main/java/org/gradle/api/plugins/quality/internal/CheckstyleInvoker.java#L161-L197","documentation":"After running Checkstyle, Gradle parses the Checkstyle XML report. If violations exist but the build is configured not to fail on them (ignoreFailures=true, or the ant failure property was not set while the report still lists violations), Gradle logs this warning with a clickable link to the report instead of throwing MarkedVerificationException. The build passes even though the code violates the configured Checkstyle rules.","triggerScenarios":"checkstyle { ignoreFailures = true } while the analyzed source has violations, or a maxWarnings/maxErrors threshold high enough that the task passes while reportXml still contains error entries, so violationsExist(reportXml) is true and the warn branch runs instead of the throw.","commonSituations":"Teams that enabled ignoreFailures temporarily when introducing Checkstyle and forgot to remove it; builds ratcheting violations down via maxWarnings; HTML-only report setups where the XML is deleted and the message points at the html/sarif report.","solutions":["Open the linked report (XML/HTML/SARIF) and fix the reported violations","Remove checkstyle { ignoreFailures = true } so the build fails again on violations","If ratcheting, set checkstyle { maxWarnings = <current count> } and lower it with every change toward 0","Suppress justified findings in a checkstyle-suppressions.xml instead of globally ignoring failures"],"exampleFix":"// before: violations silently pass with a warning\ncheckstyle {\n    ignoreFailures = true\n}\n\n// after: fail on violations, ratchet from the current count\ncheckstyle {\n    ignoreFailures = false\n    maxWarnings = 42 // lower as violations are fixed, target 0\n}","handlingStrategy":"validation","validationCode":"// fail the build when checkstyle violations exist, independent of ignoreFailures\ntasks.withType(Checkstyle).configureEach {\n    doLast {\n        def xml = reports.xml.outputLocation.asFile.get()\n        def count = new XmlSlurper().parse(xml).'**'.count { it.name() == 'error' }\n        if (count > 0) {\n            throw new GradleException(\"${count} checkstyle violations - see ${xml}\")\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never commit ignoreFailures = true; use a maxWarnings ratchet that only shrinks","Run checkstyleMain locally before pushing or wire it as a required CI stage","Track the violation count over time and fail when it increases"],"tags":["gradle","checkstyle","code-quality","static-analysis","build-warning"],"backgroundTag":"static-analysis-violations-found","analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}