violation-fixer

Runs and fixes CodeNarc, Checkstyle, PMD, and SpotBugs violations across grails-core Gradle modules.

2.9k|973|Updated Feb 10, 2010
One-click install
npx skills add https://github.com/apache/grails-core --skill violation-fixer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: violation-fixer
Source: https://github.com/apache/grails-core/tree/main/.agents/skills/violation-fixer
Command: npx skills add https://github.com/apache/grails-core --skill violation-fixer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforcing code style and static analysis across 60+ grails-core modules produces scattered XML reports and cryptic violations. This Skill explains how to run the Grails code style and analysis Gradle plugins, interpret the aggregated Markdown violation reports, and fix each class of violation so builds stay clean before committing.

Core Features & Use Cases

  • Violation Aggregation: Run ./gradlew aggregateViolations to execute Checkstyle, CodeNarc, PMD, and SpotBugs across every module and produce per-tool Markdown reports in build/reports/violations/.
  • Guided Fixes: Provides rule-by-rule fix tables for common CodeNarc and Checkstyle violations, plus the codenarcFix task for auto-fixable rules like UnnecessarySemicolon and UnnecessaryGString.
  • Configuration Control: Documents every Gradle property for enabling opt-in tools (PMD, SpotBugs, Spotless), including test sources, and ignoring failures during report collection.
  • Use Case: Before merging a pull request, run the aggregation task, auto-fix CodeNarc issues, manually resolve remaining Checkstyle import-order problems, and confirm each report reads No violations found!.

Quick Start

Run the violation aggregation across all grails-core modules and help me interpret and fix the violations reported in the generated Markdown files.

Frequently Asked Questions about violation-fixer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run code style checks across all grails-core modules?

Run ./gradlew aggregateViolations from the repository root. It executes Checkstyle and CodeNarc on every module and writes Markdown summaries like CODENARC_VIOLATIONS.md and CHECKSTYLE_VIOLATIONS.md to build/reports/violations/.

How to auto-fix CodeNarc violations in a Gradle project?

Run ./gradlew codenarcFix before the style checks. It auto-fixes rules such as UnnecessarySemicolon, UnnecessaryGString, SpaceBeforeOpeningBrace, ConsecutiveBlankLines, ClassStartsWithBlankLine, and SpaceAroundMapEntryColon.

How do I enable PMD or SpotBugs in grails-core?

Both are opt-in. Pass -Pgrails.code-analysis.enabled.pmd=true or -Pgrails.code-analysis.enabled.spotbugs=true on the Gradle command line, or set them in gradle.properties, then run the codeAnalysis or aggregateViolations task.

Can I collect violation reports without failing the build?

Yes. Pass -Pgrails.code-style.ignoreFailures=true and -Pgrails.code-analysis.ignoreFailures=true. The checks still run and write reports to build/reports/violations/, but the build does not fail on violations.

Why does Checkstyle report ImportOrder violations in grails-core?

Imports must follow a strict order: java/javax first, then groovy, jakarta, Spring packages, grails packages, and finally static imports. Reorder the import block manually to match this sequence to resolve the violation.