jamesfredley commented on code in PR #15686:
URL: https://github.com/apache/grails-core/pull/15686#discussion_r3319369500
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeStylePlugin.groovy:
##########
@@ -90,72 +100,65 @@ class GrailsCodeStylePlugin implements Plugin<Project> {
createOrLoad(
toCreate.resolve(CODENARC_CONFIG_FILE_NAME),
-
"${BASE_RESOURCE_PATH}/codenarc/${CODENARC_CONFIG_FILE_NAME}"
+
"${BASE_RESOURCE_PATH}/codenarc/${CODENARC_CONFIG_FILE_NAME}",
+ project
)
directory
})
}
- private static void createOrLoad(Path expectedPath, String
defaultResource) {
- if (!Files.exists(expectedPath) || expectedPath.size() == 0) {
+ private static void createOrLoad(Path expectedPath, String
defaultResource, Project project) {
+ boolean defaultPath =
expectedPath.startsWith(project.rootProject.buildDir.toPath())
+ if (!Files.exists(expectedPath) || expectedPath.size() == 0 ||
defaultPath) {
def defaultValue =
GrailsCodeStylePlugin.getResourceAsStream(defaultResource)
if (!defaultValue) {
throw new IllegalStateException("Could not locate default
configuration file: ${defaultResource}")
}
+ // TODO: This really need to use gradle caching instead
+ project.logger.info("Replacing code style configuration")
Review Comment:
Fixed in 0ca655d3f1. createOrLoad now only rewrites the config when the
target is missing or its on-disk content differs from the bundled resource, and
logs at debug level, so repeated builds across subprojects no longer churn the
file or spam the log.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsViolationAggregationPlugin.groovy:
##########
@@ -0,0 +1,467 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.grails.buildsrc
+
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+import groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.file.Directory
+import org.gradle.api.file.FileCollection
+import org.gradle.api.logging.Logger
+import org.gradle.api.logging.Logging
+import org.gradle.api.plugins.AppliedPlugin
+import org.gradle.api.plugins.quality.Checkstyle
+import org.gradle.api.plugins.quality.CodeNarc
+import org.gradle.api.plugins.quality.Pmd
+import org.gradle.api.provider.Provider
+import org.gradle.api.tasks.TaskProvider
+import org.gradle.testing.jacoco.tasks.JacocoReport
+
+import com.github.spotbugs.snom.SpotBugsTask
+import groovy.xml.XmlSlurper
+
+/**
+ * Root-only convention plugin that aggregates code-style violation XML
reports and JaCoCo coverage
+ * CSV reports into human-readable Markdown files under
build/reports/violations/.
+ *
+ * Apply this plugin to the root project only. Subprojects should apply
+ * grails-code-style and grails-jacoco individually.
+ *
+ * Tasks registered:
+ * aggregateStyleViolations — CodeNarc + Checkstyle only
+ * aggregateAnalysisViolations — PMD + SpotBugs only (requires opt-in
properties)
+ * aggregateViolations — depends on both of the above
+ * aggregateJacocoCoverage — JaCoCo CSV → Markdown
+ */
+@CompileStatic
+class GrailsViolationAggregationPlugin implements Plugin<Project> {
+
+ private static final Logger LOGGER =
Logging.getLogger(GrailsViolationAggregationPlugin)
+
+ @Override
+ void apply(Project project) {
+ if (project != project.rootProject) {
+ throw new GradleException(
+ 'GrailsViolationAggregationPlugin must be applied to the root
project only. ' +
+ 'Apply grails-code-style and grails-jacoco to subprojects
instead.'
+ )
+ }
+
+ Provider<Directory> violationsDir =
project.layout.buildDirectory.dir('reports/violations')
+ Provider<Directory> styleXmlDir =
project.layout.buildDirectory.dir('reports/codestyle')
+ Provider<Directory> analysisXmlDir =
project.layout.buildDirectory.dir('reports/codeanalysis')
+
+ TaskProvider<Task> styleTask = registerStyleAggregation(project,
styleXmlDir, violationsDir)
+ TaskProvider<Task> analysisTask = registerAnalysisAggregation(project,
analysisXmlDir, violationsDir)
+ registerJacocoAggregation(project, violationsDir)
+
+ project.tasks.register('aggregateViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates all violation reports (style +
analysis) into build/reports/violations/'
+ task.dependsOn(styleTask, analysisTask)
+ }
+ }
+
+ private static TaskProvider<Task> registerStyleAggregation(Project root,
Provider<Directory> styleXmlDir, Provider<Directory> violationsDir) {
+ // Wire property flags as Providers — values are resolved at task
execution time, not at apply() time,
+ // and Providers are configuration-cache safe to capture in task
actions
+ Provider<Boolean> checkStyleTests = GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.TEST_STYLING_PROPERTY)
+ Provider<Boolean> codenarcEnabled = GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.CODENARC_ENABLED_PROPERTY, true)
+ Provider<Boolean> checkstyleEnabled =
GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.CHECKSTYLE_ENABLED_PROPERTY, true)
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateStyleViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates CodeNarc and Checkstyle violation
reports into build/reports/violations/'
+
task.outputs.file(root.file('build/reports/violations/CODENARC_VIOLATIONS.md'))
+
task.outputs.file(root.file('build/reports/violations/CHECKSTYLE_VIOLATIONS.md'))
+ task.doLast {
+ parseStyleViolations(styleXmlDir.get(), violationsDir.get(),
+ checkStyleTests.get(), codenarcEnabled.get(),
checkstyleEnabled.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('codenarc') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(CodeNarc))
+ }
+ }
+ sub.pluginManager.withPlugin('checkstyle') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(Checkstyle))
+ }
+ }
+ }
+ aggregateTask
+ }
+
+ private static TaskProvider<Task> registerAnalysisAggregation(Project
root, Provider<Directory> analysisXmlDir, Provider<Directory> violationsDir) {
+ Provider<Boolean> checkAnalysisTests =
GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.TEST_ANALYSIS_PROPERTY)
+ Provider<Boolean> pmdEnabled = GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.PMD_ENABLED_PROPERTY)
+ Provider<Boolean> spotbugsEnabled = GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.SPOTBUGS_ENABLED_PROPERTY)
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateAnalysisViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates PMD and SpotBugs violation reports
into build/reports/violations/'
+
task.outputs.file(root.file('build/reports/violations/PMD_VIOLATIONS.md'))
+
task.outputs.file(root.file('build/reports/violations/SPOTBUGS_VIOLATIONS.md'))
+ task.doLast {
+ parseAnalysisViolations(analysisXmlDir.get(),
violationsDir.get(),
+ checkAnalysisTests.get(), pmdEnabled.get(),
spotbugsEnabled.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('pmd') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(Pmd))
+ }
+ }
+ sub.pluginManager.withPlugin('com.github.spotbugs') {
AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(SpotBugsTask))
+ }
+ }
+ }
+ aggregateTask
+ }
+
+ private static void registerJacocoAggregation(Project root,
Provider<Directory> violationsDir) {
+ // Collect all potential CSV paths at configuration time — Project
must not be referenced from task actions
+ FileCollection jacocoCsvFiles = root.files(
+ root.allprojects.collect { Project p ->
p.file('build/reports/jacoco/test/jacocoTestReport.csv') }
+ )
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateJacocoCoverage') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates JaCoCo coverage reports from all
subprojects into build/reports/violations/'
+ task.inputs.files(jacocoCsvFiles).optional(true)
+
task.outputs.file(root.file('build/reports/violations/JACOCO_COVERAGE.md'))
+ task.doLast {
+ parseJacocoCoverage(jacocoCsvFiles, violationsDir.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('jacoco') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(JacocoReport))
+ }
+ }
+ }
+ }
+
+ @CompileDynamic
+ private static void parseStyleViolations(Directory styleXmlDir, Directory
violationsDir,
+ boolean checkStyleTests, boolean codenarcEnabled, boolean
checkstyleEnabled) {
+ def slurper = new XmlSlurper()
+
slurper.setFeature('http://apache.org/xml/features/nonvalidating/load-external-dtd',
false)
+ slurper.setFeature('http://xml.org/sax/features/namespaces', false)
Review Comment:
Fixed in 0ca655d3f1. The XmlSlurper now disallows DOCTYPE declarations and
disables external general and parameter entities (in addition to the existing
external-DTD and namespace settings) before parsing any report XML.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsViolationAggregationPlugin.groovy:
##########
@@ -0,0 +1,467 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.grails.buildsrc
+
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+import groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.file.Directory
+import org.gradle.api.file.FileCollection
+import org.gradle.api.logging.Logger
+import org.gradle.api.logging.Logging
+import org.gradle.api.plugins.AppliedPlugin
+import org.gradle.api.plugins.quality.Checkstyle
+import org.gradle.api.plugins.quality.CodeNarc
+import org.gradle.api.plugins.quality.Pmd
+import org.gradle.api.provider.Provider
+import org.gradle.api.tasks.TaskProvider
+import org.gradle.testing.jacoco.tasks.JacocoReport
+
+import com.github.spotbugs.snom.SpotBugsTask
+import groovy.xml.XmlSlurper
+
+/**
+ * Root-only convention plugin that aggregates code-style violation XML
reports and JaCoCo coverage
+ * CSV reports into human-readable Markdown files under
build/reports/violations/.
+ *
+ * Apply this plugin to the root project only. Subprojects should apply
+ * grails-code-style and grails-jacoco individually.
+ *
+ * Tasks registered:
+ * aggregateStyleViolations — CodeNarc + Checkstyle only
+ * aggregateAnalysisViolations — PMD + SpotBugs only (requires opt-in
properties)
+ * aggregateViolations — depends on both of the above
+ * aggregateJacocoCoverage — JaCoCo CSV → Markdown
+ */
+@CompileStatic
+class GrailsViolationAggregationPlugin implements Plugin<Project> {
+
+ private static final Logger LOGGER =
Logging.getLogger(GrailsViolationAggregationPlugin)
+
+ @Override
+ void apply(Project project) {
+ if (project != project.rootProject) {
+ throw new GradleException(
+ 'GrailsViolationAggregationPlugin must be applied to the root
project only. ' +
+ 'Apply grails-code-style and grails-jacoco to subprojects
instead.'
+ )
+ }
+
+ Provider<Directory> violationsDir =
project.layout.buildDirectory.dir('reports/violations')
+ Provider<Directory> styleXmlDir =
project.layout.buildDirectory.dir('reports/codestyle')
+ Provider<Directory> analysisXmlDir =
project.layout.buildDirectory.dir('reports/codeanalysis')
+
+ TaskProvider<Task> styleTask = registerStyleAggregation(project,
styleXmlDir, violationsDir)
+ TaskProvider<Task> analysisTask = registerAnalysisAggregation(project,
analysisXmlDir, violationsDir)
+ registerJacocoAggregation(project, violationsDir)
+
+ project.tasks.register('aggregateViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates all violation reports (style +
analysis) into build/reports/violations/'
+ task.dependsOn(styleTask, analysisTask)
+ }
+ }
+
+ private static TaskProvider<Task> registerStyleAggregation(Project root,
Provider<Directory> styleXmlDir, Provider<Directory> violationsDir) {
+ // Wire property flags as Providers — values are resolved at task
execution time, not at apply() time,
+ // and Providers are configuration-cache safe to capture in task
actions
+ Provider<Boolean> checkStyleTests = GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.TEST_STYLING_PROPERTY)
+ Provider<Boolean> codenarcEnabled = GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.CODENARC_ENABLED_PROPERTY, true)
+ Provider<Boolean> checkstyleEnabled =
GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.CHECKSTYLE_ENABLED_PROPERTY, true)
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateStyleViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates CodeNarc and Checkstyle violation
reports into build/reports/violations/'
+
task.outputs.file(root.file('build/reports/violations/CODENARC_VIOLATIONS.md'))
+
task.outputs.file(root.file('build/reports/violations/CHECKSTYLE_VIOLATIONS.md'))
+ task.doLast {
+ parseStyleViolations(styleXmlDir.get(), violationsDir.get(),
+ checkStyleTests.get(), codenarcEnabled.get(),
checkstyleEnabled.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('codenarc') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(CodeNarc))
+ }
+ }
+ sub.pluginManager.withPlugin('checkstyle') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(Checkstyle))
+ }
+ }
+ }
+ aggregateTask
+ }
+
+ private static TaskProvider<Task> registerAnalysisAggregation(Project
root, Provider<Directory> analysisXmlDir, Provider<Directory> violationsDir) {
+ Provider<Boolean> checkAnalysisTests =
GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.TEST_ANALYSIS_PROPERTY)
+ Provider<Boolean> pmdEnabled = GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.PMD_ENABLED_PROPERTY)
+ Provider<Boolean> spotbugsEnabled = GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.SPOTBUGS_ENABLED_PROPERTY)
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateAnalysisViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates PMD and SpotBugs violation reports
into build/reports/violations/'
+
task.outputs.file(root.file('build/reports/violations/PMD_VIOLATIONS.md'))
+
task.outputs.file(root.file('build/reports/violations/SPOTBUGS_VIOLATIONS.md'))
+ task.doLast {
+ parseAnalysisViolations(analysisXmlDir.get(),
violationsDir.get(),
+ checkAnalysisTests.get(), pmdEnabled.get(),
spotbugsEnabled.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('pmd') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(Pmd))
+ }
+ }
+ sub.pluginManager.withPlugin('com.github.spotbugs') {
AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(SpotBugsTask))
+ }
+ }
+ }
+ aggregateTask
+ }
+
+ private static void registerJacocoAggregation(Project root,
Provider<Directory> violationsDir) {
+ // Collect all potential CSV paths at configuration time — Project
must not be referenced from task actions
+ FileCollection jacocoCsvFiles = root.files(
+ root.allprojects.collect { Project p ->
p.file('build/reports/jacoco/test/jacocoTestReport.csv') }
+ )
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateJacocoCoverage') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates JaCoCo coverage reports from all
subprojects into build/reports/violations/'
+ task.inputs.files(jacocoCsvFiles).optional(true)
+
task.outputs.file(root.file('build/reports/violations/JACOCO_COVERAGE.md'))
+ task.doLast {
+ parseJacocoCoverage(jacocoCsvFiles, violationsDir.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('jacoco') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(JacocoReport))
+ }
+ }
+ }
+ }
+
+ @CompileDynamic
+ private static void parseStyleViolations(Directory styleXmlDir, Directory
violationsDir,
+ boolean checkStyleTests, boolean codenarcEnabled, boolean
checkstyleEnabled) {
+ def slurper = new XmlSlurper()
+
slurper.setFeature('http://apache.org/xml/features/nonvalidating/load-external-dtd',
false)
+ slurper.setFeature('http://xml.org/sax/features/namespaces', false)
+
+ def getModule = { String fileName ->
+ def lastDash = fileName.lastIndexOf('-')
+ lastDash != -1 ? fileName.substring(0, lastDash) : fileName
+ }
+
+ def isTestFile = { String fileName ->
+ fileName.toLowerCase().contains('test') ||
fileName.toLowerCase().contains('integrationtest')
+ }
+
+ def shouldSkipClass = { boolean includeTests, String className, String
filePath = null ->
+ if (includeTests) {
+ return false
+ }
+ if (filePath && (filePath.contains('src/test/') ||
filePath.contains('src/integrationTest/'))) {
+ return true
+ }
+ !filePath && (className.contains('Spec') ||
className.contains('Test') || className.contains('Tests'))
+ }
+
+ def writeReport = { String fileName, List violations, String title ->
+ def outDir = violationsDir.asFile
+ outDir.mkdirs()
+ def reportFile = new File(outDir, fileName)
+ def out = new StringBuilder()
+ out.append("# ${title}\n")
+ out.append("Generated on:
${LocalDateTime.now().format(DateTimeFormatter.ofPattern('yyyy-MM-dd
HH:mm:ss'))}\n\n")
+
+ if (violations.isEmpty()) {
+ out.append('No violations found! 🎉\n')
+ } else {
+ def uniqueViolations = violations.unique().sort { v ->
"${v.module}:${v.className}:${v.line}" }
+ def groupedByModule = uniqueViolations.groupBy { it.module
}.sort()
+ groupedByModule.each { module, modViolations ->
+ out.append("## Module: ${module}\n")
+ out.append('| Class | Tool | Violation | Line | Message
|\n')
+ out.append('| :--- | :--- | :--- | :--- | :--- |\n')
+ modViolations.each { v ->
+ out.append("| ${v.className} | ${v.tool} | ${v.type} |
${v.line} | ${v.message.replaceAll(/\|/, '\\|')} |\n")
+ }
+ out.append('\n')
+ }
+ }
+ reportFile.text = out.toString()
+ LOGGER.lifecycle("Aggregated report generated:
${reportFile.absolutePath}")
+ }
+
+ // CodeNarc
+ def codenarcViolations = []
+ def codenarcDir = styleXmlDir.dir('codenarc').asFile
+ if (codenarcDir.exists() && codenarcEnabled) {
+ codenarcDir.eachFileMatch(~/.*\.xml/) { file ->
+ if (file.size() == 0 || (!checkStyleTests &&
isTestFile(file.name))) {
+ return
+ }
+ def module = getModule(file.name)
+ def xml = slurper.parse(file)
+ xml.Package.each { pkg ->
+ pkg.File.each { f ->
+ def pkgName = [email protected]()
+ def fileName = [email protected]()
+ def className = pkgName ? "${pkgName}.${fileName}" :
fileName
+ className = className.replace('.groovy',
'').replace('.java', '')
+ if (shouldSkipClass(checkStyleTests, className,
[email protected]())) {
+ return
+ }
+ f.Violation.each { v ->
+ codenarcViolations << [
+ module : module,
+ className: className,
+ tool : 'CodeNarc',
+ type : [email protected](),
+ line : [email protected](),
+ message : v.Message.text().trim()
+ ]
+ }
+ }
+ }
+ }
+ }
+ writeReport('CODENARC_VIOLATIONS.md', codenarcViolations, 'CodeNarc
Violations Summary')
+
+ // Checkstyle
+ def checkstyleViolations = []
+ def checkstyleDir = styleXmlDir.dir('checkstyle').asFile
+ if (checkstyleDir.exists() && checkstyleEnabled) {
+ checkstyleDir.eachFileMatch(~/.*\.xml/) { file ->
+ if (file.size() == 0 || (!checkStyleTests &&
isTestFile(file.name))) {
+ return
+ }
+ def module = getModule(file.name)
+ def xml = slurper.parse(file)
+ xml.file.each { f ->
+ def filePath = [email protected]()
+ def className = filePath.contains('src/main/groovy/') ?
filePath.split('src/main/groovy/')[1] :
+ filePath.contains('src/main/java/') ?
filePath.split('src/main/java/')[1] :
+ filePath.contains('src/test/groovy/') ?
filePath.split('src/test/groovy/')[1] :
+ filePath.contains('src/test/java/') ?
filePath.split('src/test/java/')[1] :
+ filePath.split('/').last()
+ className = className.replace('.groovy',
'').replace('.java', '').replace('/', '.')
+ if (shouldSkipClass(checkStyleTests, className)) {
+ return
+ }
+ f.error.each { e ->
+ checkstyleViolations << [
+ module : module,
+ className: className,
+ tool : 'Checkstyle',
+ type :
[email protected]().split(/\./).last(),
+ line : [email protected](),
+ message : [email protected]().trim()
+ ]
+ }
+ }
+ }
+ }
+ writeReport('CHECKSTYLE_VIOLATIONS.md', checkstyleViolations,
'Checkstyle Violations Summary')
+ }
+
+ @CompileDynamic
+ private static void parseAnalysisViolations(Directory analysisXmlDir,
Directory violationsDir,
+ boolean checkAnalysisTests, boolean pmdEnabled, boolean
spotbugsEnabled) {
+ def slurper = new XmlSlurper()
+
slurper.setFeature('http://apache.org/xml/features/nonvalidating/load-external-dtd',
false)
+ slurper.setFeature('http://xml.org/sax/features/namespaces', false)
Review Comment:
Fixed in 0ca655d3f1. The XmlSlurper now disallows DOCTYPE declarations and
disables external general and parameter entities (in addition to the existing
external-DTD and namespace settings) before parsing any report XML.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsViolationAggregationPlugin.groovy:
##########
@@ -0,0 +1,467 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.grails.buildsrc
+
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+import groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.file.Directory
+import org.gradle.api.file.FileCollection
+import org.gradle.api.logging.Logger
+import org.gradle.api.logging.Logging
+import org.gradle.api.plugins.AppliedPlugin
+import org.gradle.api.plugins.quality.Checkstyle
+import org.gradle.api.plugins.quality.CodeNarc
+import org.gradle.api.plugins.quality.Pmd
+import org.gradle.api.provider.Provider
+import org.gradle.api.tasks.TaskProvider
+import org.gradle.testing.jacoco.tasks.JacocoReport
+
+import com.github.spotbugs.snom.SpotBugsTask
+import groovy.xml.XmlSlurper
+
+/**
+ * Root-only convention plugin that aggregates code-style violation XML
reports and JaCoCo coverage
+ * CSV reports into human-readable Markdown files under
build/reports/violations/.
+ *
+ * Apply this plugin to the root project only. Subprojects should apply
+ * grails-code-style and grails-jacoco individually.
+ *
+ * Tasks registered:
+ * aggregateStyleViolations — CodeNarc + Checkstyle only
+ * aggregateAnalysisViolations — PMD + SpotBugs only (requires opt-in
properties)
+ * aggregateViolations — depends on both of the above
+ * aggregateJacocoCoverage — JaCoCo CSV → Markdown
+ */
+@CompileStatic
+class GrailsViolationAggregationPlugin implements Plugin<Project> {
+
+ private static final Logger LOGGER =
Logging.getLogger(GrailsViolationAggregationPlugin)
+
+ @Override
+ void apply(Project project) {
+ if (project != project.rootProject) {
+ throw new GradleException(
+ 'GrailsViolationAggregationPlugin must be applied to the root
project only. ' +
+ 'Apply grails-code-style and grails-jacoco to subprojects
instead.'
+ )
+ }
+
+ Provider<Directory> violationsDir =
project.layout.buildDirectory.dir('reports/violations')
+ Provider<Directory> styleXmlDir =
project.layout.buildDirectory.dir('reports/codestyle')
+ Provider<Directory> analysisXmlDir =
project.layout.buildDirectory.dir('reports/codeanalysis')
+
+ TaskProvider<Task> styleTask = registerStyleAggregation(project,
styleXmlDir, violationsDir)
+ TaskProvider<Task> analysisTask = registerAnalysisAggregation(project,
analysisXmlDir, violationsDir)
+ registerJacocoAggregation(project, violationsDir)
+
+ project.tasks.register('aggregateViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates all violation reports (style +
analysis) into build/reports/violations/'
+ task.dependsOn(styleTask, analysisTask)
+ }
+ }
+
+ private static TaskProvider<Task> registerStyleAggregation(Project root,
Provider<Directory> styleXmlDir, Provider<Directory> violationsDir) {
+ // Wire property flags as Providers — values are resolved at task
execution time, not at apply() time,
+ // and Providers are configuration-cache safe to capture in task
actions
+ Provider<Boolean> checkStyleTests = GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.TEST_STYLING_PROPERTY)
+ Provider<Boolean> codenarcEnabled = GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.CODENARC_ENABLED_PROPERTY, true)
+ Provider<Boolean> checkstyleEnabled =
GradleUtils.booleanProvider(root,
GrailsCodeStylePlugin.CHECKSTYLE_ENABLED_PROPERTY, true)
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateStyleViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates CodeNarc and Checkstyle violation
reports into build/reports/violations/'
+
task.outputs.file(root.file('build/reports/violations/CODENARC_VIOLATIONS.md'))
+
task.outputs.file(root.file('build/reports/violations/CHECKSTYLE_VIOLATIONS.md'))
+ task.doLast {
+ parseStyleViolations(styleXmlDir.get(), violationsDir.get(),
+ checkStyleTests.get(), codenarcEnabled.get(),
checkstyleEnabled.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('codenarc') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(CodeNarc))
+ }
+ }
+ sub.pluginManager.withPlugin('checkstyle') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(Checkstyle))
+ }
+ }
+ }
+ aggregateTask
+ }
+
+ private static TaskProvider<Task> registerAnalysisAggregation(Project
root, Provider<Directory> analysisXmlDir, Provider<Directory> violationsDir) {
+ Provider<Boolean> checkAnalysisTests =
GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.TEST_ANALYSIS_PROPERTY)
+ Provider<Boolean> pmdEnabled = GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.PMD_ENABLED_PROPERTY)
+ Provider<Boolean> spotbugsEnabled = GradleUtils.booleanProvider(root,
GrailsCodeAnalysisPlugin.SPOTBUGS_ENABLED_PROPERTY)
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateAnalysisViolations') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates PMD and SpotBugs violation reports
into build/reports/violations/'
+
task.outputs.file(root.file('build/reports/violations/PMD_VIOLATIONS.md'))
+
task.outputs.file(root.file('build/reports/violations/SPOTBUGS_VIOLATIONS.md'))
+ task.doLast {
+ parseAnalysisViolations(analysisXmlDir.get(),
violationsDir.get(),
+ checkAnalysisTests.get(), pmdEnabled.get(),
spotbugsEnabled.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('pmd') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(Pmd))
+ }
+ }
+ sub.pluginManager.withPlugin('com.github.spotbugs') {
AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(SpotBugsTask))
+ }
+ }
+ }
+ aggregateTask
+ }
+
+ private static void registerJacocoAggregation(Project root,
Provider<Directory> violationsDir) {
+ // Collect all potential CSV paths at configuration time — Project
must not be referenced from task actions
+ FileCollection jacocoCsvFiles = root.files(
+ root.allprojects.collect { Project p ->
p.file('build/reports/jacoco/test/jacocoTestReport.csv') }
+ )
+
+ TaskProvider<Task> aggregateTask =
root.tasks.register('aggregateJacocoCoverage') { Task task ->
+ task.group = 'verification'
+ task.description = 'Aggregates JaCoCo coverage reports from all
subprojects into build/reports/violations/'
+ task.inputs.files(jacocoCsvFiles).optional(true)
+
task.outputs.file(root.file('build/reports/violations/JACOCO_COVERAGE.md'))
+ task.doLast {
+ parseJacocoCoverage(jacocoCsvFiles, violationsDir.get())
+ }
+ }
+ root.subprojects { Project sub ->
+ sub.pluginManager.withPlugin('jacoco') { AppliedPlugin p ->
+ aggregateTask.configure { Task task ->
+ task.dependsOn(sub.tasks.withType(JacocoReport))
+ }
+ }
+ }
+ }
+
+ @CompileDynamic
+ private static void parseStyleViolations(Directory styleXmlDir, Directory
violationsDir,
+ boolean checkStyleTests, boolean codenarcEnabled, boolean
checkstyleEnabled) {
+ def slurper = new XmlSlurper()
+
slurper.setFeature('http://apache.org/xml/features/nonvalidating/load-external-dtd',
false)
+ slurper.setFeature('http://xml.org/sax/features/namespaces', false)
+
+ def getModule = { String fileName ->
+ def lastDash = fileName.lastIndexOf('-')
+ lastDash != -1 ? fileName.substring(0, lastDash) : fileName
+ }
+
+ def isTestFile = { String fileName ->
+ fileName.toLowerCase().contains('test') ||
fileName.toLowerCase().contains('integrationtest')
+ }
+
+ def shouldSkipClass = { boolean includeTests, String className, String
filePath = null ->
+ if (includeTests) {
+ return false
+ }
+ if (filePath && (filePath.contains('src/test/') ||
filePath.contains('src/integrationTest/'))) {
+ return true
+ }
+ !filePath && (className.contains('Spec') ||
className.contains('Test') || className.contains('Tests'))
+ }
+
+ def writeReport = { String fileName, List violations, String title ->
+ def outDir = violationsDir.asFile
+ outDir.mkdirs()
+ def reportFile = new File(outDir, fileName)
+ def out = new StringBuilder()
+ out.append("# ${title}\n")
+ out.append("Generated on:
${LocalDateTime.now().format(DateTimeFormatter.ofPattern('yyyy-MM-dd
HH:mm:ss'))}\n\n")
+
+ if (violations.isEmpty()) {
+ out.append('No violations found! 🎉\n')
+ } else {
+ def uniqueViolations = violations.unique().sort { v ->
"${v.module}:${v.className}:${v.line}" }
+ def groupedByModule = uniqueViolations.groupBy { it.module
}.sort()
+ groupedByModule.each { module, modViolations ->
+ out.append("## Module: ${module}\n")
+ out.append('| Class | Tool | Violation | Line | Message
|\n')
+ out.append('| :--- | :--- | :--- | :--- | :--- |\n')
+ modViolations.each { v ->
+ out.append("| ${v.className} | ${v.tool} | ${v.type} |
${v.line} | ${v.message.replaceAll(/\|/, '\\|')} |\n")
+ }
+ out.append('\n')
+ }
+ }
+ reportFile.text = out.toString()
+ LOGGER.lifecycle("Aggregated report generated:
${reportFile.absolutePath}")
+ }
+
+ // CodeNarc
+ def codenarcViolations = []
+ def codenarcDir = styleXmlDir.dir('codenarc').asFile
+ if (codenarcDir.exists() && codenarcEnabled) {
+ codenarcDir.eachFileMatch(~/.*\.xml/) { file ->
+ if (file.size() == 0 || (!checkStyleTests &&
isTestFile(file.name))) {
+ return
+ }
+ def module = getModule(file.name)
+ def xml = slurper.parse(file)
+ xml.Package.each { pkg ->
+ pkg.File.each { f ->
+ def pkgName = [email protected]()
+ def fileName = [email protected]()
+ def className = pkgName ? "${pkgName}.${fileName}" :
fileName
+ className = className.replace('.groovy',
'').replace('.java', '')
+ if (shouldSkipClass(checkStyleTests, className,
[email protected]())) {
+ return
+ }
+ f.Violation.each { v ->
+ codenarcViolations << [
+ module : module,
+ className: className,
+ tool : 'CodeNarc',
+ type : [email protected](),
+ line : [email protected](),
+ message : v.Message.text().trim()
+ ]
+ }
+ }
+ }
+ }
+ }
+ writeReport('CODENARC_VIOLATIONS.md', codenarcViolations, 'CodeNarc
Violations Summary')
+
+ // Checkstyle
+ def checkstyleViolations = []
+ def checkstyleDir = styleXmlDir.dir('checkstyle').asFile
+ if (checkstyleDir.exists() && checkstyleEnabled) {
+ checkstyleDir.eachFileMatch(~/.*\.xml/) { file ->
+ if (file.size() == 0 || (!checkStyleTests &&
isTestFile(file.name))) {
+ return
+ }
+ def module = getModule(file.name)
+ def xml = slurper.parse(file)
+ xml.file.each { f ->
+ def filePath = [email protected]()
+ def className = filePath.contains('src/main/groovy/') ?
filePath.split('src/main/groovy/')[1] :
+ filePath.contains('src/main/java/') ?
filePath.split('src/main/java/')[1] :
+ filePath.contains('src/test/groovy/') ?
filePath.split('src/test/groovy/')[1] :
+ filePath.contains('src/test/java/') ?
filePath.split('src/test/java/')[1] :
+ filePath.split('/').last()
+ className = className.replace('.groovy',
'').replace('.java', '').replace('/', '.')
+ if (shouldSkipClass(checkStyleTests, className)) {
+ return
+ }
+ f.error.each { e ->
+ checkstyleViolations << [
+ module : module,
+ className: className,
+ tool : 'Checkstyle',
+ type :
[email protected]().split(/\./).last(),
+ line : [email protected](),
+ message : [email protected]().trim()
+ ]
+ }
+ }
+ }
+ }
+ writeReport('CHECKSTYLE_VIOLATIONS.md', checkstyleViolations,
'Checkstyle Violations Summary')
+ }
+
+ @CompileDynamic
+ private static void parseAnalysisViolations(Directory analysisXmlDir,
Directory violationsDir,
+ boolean checkAnalysisTests, boolean pmdEnabled, boolean
spotbugsEnabled) {
+ def slurper = new XmlSlurper()
+
slurper.setFeature('http://apache.org/xml/features/nonvalidating/load-external-dtd',
false)
+ slurper.setFeature('http://xml.org/sax/features/namespaces', false)
+
+ def getModule = { String fileName ->
+ def lastDash = fileName.lastIndexOf('-')
+ lastDash != -1 ? fileName.substring(0, lastDash) : fileName
+ }
+
+ def isTestFile = { String fileName ->
+ fileName.toLowerCase().contains('test') ||
fileName.toLowerCase().contains('integrationtest')
+ }
+
+ def shouldSkipClass = { boolean includeTests, String className ->
+ if (includeTests) {
+ return false
+ }
+ className.contains('Spec') || className.contains('Test') ||
className.contains('Tests')
+ }
+
+ def writeReport = { String fileName, List violations, String title ->
+ def outDir = violationsDir.asFile
+ outDir.mkdirs()
+ def reportFile = new File(outDir, fileName)
+ def out = new StringBuilder()
+ out.append("# ${title}\n")
+ out.append("Generated on:
${LocalDateTime.now().format(DateTimeFormatter.ofPattern('yyyy-MM-dd
HH:mm:ss'))}\n\n")
+
+ if (violations.isEmpty()) {
+ out.append('No violations found! 🎉\n')
+ } else {
+ def uniqueViolations = violations.unique().sort { v ->
"${v.module}:${v.className}:${v.line}" }
+ def groupedByModule = uniqueViolations.groupBy { it.module
}.sort()
+ groupedByModule.each { module, modViolations ->
+ out.append("## Module: ${module}\n")
+ out.append('| Class | Tool | Violation | Line | Message
|\n')
+ out.append('| :--- | :--- | :--- | :--- | :--- |\n')
+ modViolations.each { v ->
+ out.append("| ${v.className} | ${v.tool} | ${v.type} |
${v.line} | ${v.message.replaceAll(/\|/, '\\|')} |\n")
+ }
+ out.append('\n')
+ }
+ }
+ reportFile.text = out.toString()
+ LOGGER.lifecycle("Aggregated report generated:
${reportFile.absolutePath}")
+ }
+
+ // PMD
+ def pmdViolations = []
+ def pmdDir = analysisXmlDir.dir('pmd').asFile
+ if (pmdDir.exists() && pmdEnabled) {
+ pmdDir.eachFileMatch(~/.*\.xml/) { file ->
+ if (file.size() == 0 || (!checkAnalysisTests &&
isTestFile(file.name))) {
+ return
+ }
+ def module = getModule(file.name)
+ def xml = slurper.parse(file)
+ xml.file.each { f ->
+ f.violation.each { v ->
+ def className = "${v.@package}.${v.@class}"
+ if (shouldSkipClass(checkAnalysisTests, className)) {
+ return
+ }
+ pmdViolations << [
+ module : module,
+ className: className,
+ tool : 'PMD',
+ type : [email protected](),
+ line : [email protected](),
+ message : v.text().trim()
+ ]
+ }
+ }
+ }
+ }
+ writeReport('PMD_VIOLATIONS.md', pmdViolations, 'PMD Violations
Summary')
+
+ // SpotBugs
+ def spotbugsViolations = []
+ def spotbugsDir = analysisXmlDir.dir('spotbugs').asFile
+ if (spotbugsDir.exists() && spotbugsEnabled) {
+ spotbugsDir.eachFileMatch(~/.*\.xml/) { file ->
+ if (file.size() == 0 || (!checkAnalysisTests &&
isTestFile(file.name))) {
+ return
+ }
+ def module = getModule(file.name)
+ def xml = slurper.parse(file)
+ xml.BugInstance.each { b ->
+ def className = [email protected]()
+ if (shouldSkipClass(checkAnalysisTests, className)) {
+ return
+ }
+ spotbugsViolations << [
+ module : module,
+ className: className,
+ tool : 'SpotBugs',
+ type : [email protected](),
+ line : [email protected](),
+ message : b.LongMessage.text().trim()
+ ]
+ }
+ }
+ }
+ writeReport('SPOTBUGS_VIOLATIONS.md', spotbugsViolations, 'SpotBugs
Violations Summary')
+ }
+
+ @CompileDynamic
+ private static void parseJacocoCoverage(FileCollection csvFiles, Directory
violationsDir) {
+ def jacocoCoverage = []
+ csvFiles.each { File csvReport ->
+ if (csvReport.exists()) {
+ LOGGER.debug("Processing JaCoCo report:
${csvReport.absolutePath}")
+ csvReport.splitEachLine(',') { fields ->
+ if (fields.size() < 5 || fields[0] == 'GROUP') {
+ return
+ }
+ def module = fields[0]
+ def pkg = fields[1]
+ def clazz = fields[2]
+ def missedStr = fields[3]
+ def coveredStr = fields[4]
+
+ if (missedStr.isNumber() && coveredStr.isNumber()) {
+ def m = missedStr.toInteger()
+ def c = coveredStr.toInteger()
+ def total = m + c
+ def percent = total > 0 ? (c * 100 / total).round(2) :
100.0
+
+ jacocoCoverage << [
+ module : module,
+ className: "${pkg}.${clazz}",
+ percent : percent
+ ]
+ }
+ }
+ }
+ }
+
+ if (jacocoCoverage.isEmpty()) {
+ LOGGER.info('No JaCoCo coverage reports found to aggregate')
+ return
+ }
+
+ jacocoCoverage.removeIf {
it.className.startsWith('org.grails.orm.hibernate.support.hibernate7.') }
+
Review Comment:
This filter is intentional. The hibernate5 and hibernate7 variants compile
classes with identical fully-qualified names, and JaCoCo cannot aggregate
coverage for two different classes that share a name (it fails with 'Can't add
different class with same name'). Dropping the hibernate7 support classes keeps
the aggregate valid. I agree it should not be hard-coded in a generic plugin
long-term and will make it configurable via an extension property in a
follow-up, so leaving this thread open to track that.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeStyleExtension.groovy:
##########
@@ -25,18 +25,19 @@ import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.model.ObjectFactory
+import org.gradle.api.provider.Property
Review Comment:
Fixed in 0ca655d3f1, removed the unused org.gradle.api.provider.Property
import.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeAnalysisExtension.groovy:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.grails.buildsrc
+
+import javax.inject.Inject
+
+import groovy.transform.CompileStatic
+
+import org.gradle.api.Project
+import org.gradle.api.file.DirectoryProperty
+import org.gradle.api.model.ObjectFactory
+
+@CompileStatic
+class GrailsCodeAnalysisExtension {
+
+ /**
+ * Defaults to project.rootProject.buildDir/codestyle/pmd.
Review Comment:
Fixed in 0ca655d3f1, the javadoc now reads build/codeanalysis/pmd to match
the actual convention.
##########
.agents/skills/violation-fixer/SKILL.md:
##########
@@ -0,0 +1,231 @@
+---
+name: violation-fixer
+description: Guide for running, interpreting, and fixing code style and
analysis violations in grails-core using GrailsCodeStylePlugin,
GrailsCodeAnalysisPlugin, and GrailsViolationAggregationPlugin — covering
CodeNarc, Checkstyle, PMD, SpotBugs, and JaCoCo
+license: Apache-2.0
+---
+<!--
+SPDX-License-Identifier: Apache-2.0
+
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements; and to You under the Apache License, Version 2.0.
+-->
+
+## What I Do
+
+- Explain how `GrailsCodeStylePlugin`, `GrailsCodeAnalysisPlugin`, and
`GrailsViolationAggregationPlugin` enforce code quality across all 60+ modules.
+- Guide you through running style and analysis checks, interpreting the
per-tool Markdown violation reports, and fixing each class of violation.
+- Describe which tools are always-on vs. opt-in, how to configure them via
Gradle properties, and which violations can be auto-fixed.
+
+## When to Use Me
+
+Activate this skill when:
+
+- Running `./gradlew aggregateViolations` and interpreting the resulting
`*_VIOLATIONS.md` files.
+- Fixing CodeNarc, Checkstyle, PMD, SpotBugs, or Spotless violations reported
in those files.
+- Configuring code style or analysis tools across the repo (enabling/disabling
tools or adjusting rule files).
+- Preparing a commit — the plugin output must be clean before merging.
+
+---
+
+## Plugin Overview
+
+| Plugin | Applied to | Responsibility |
+|--------|-----------|----------------|
+| `org.apache.grails.gradle.grails-code-style` | Every subproject | Applies
Checkstyle and CodeNarc; registers per-project `codeStyle` task; redirects XML
reports to root `build/reports/codestyle/` |
+| `org.apache.grails.gradle.grails-code-analysis` | Every subproject | Applies
PMD and SpotBugs (both opt-in); registers per-project `codeAnalysis` task;
redirects XML reports to root `build/reports/codestyle/` |
Review Comment:
Fixed in 0ca655d3f1, the grails-code-analysis row now points to
build/reports/codeanalysis/.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]