General
Running
Using
Report Types
Rules
Developing
CodeNarc
Static Analysis for Groovy
CodeNarc analyzes Groovy code for defects, bad practices, inconsistencies, style issues
and more. A flexible framework for rules, rulesets and custom rules means it’s easy to configure CodeNarc
to fit into your project. Build tool, framework support, and report generation are all enterprise ready.
CodeNarc Rules
CodeNarc triggers violations based on rules. Click the links to the left to view the
index of all rules, or individual rule categories (rulesets), such as
the basic, or import
rules. Or you can create your own ruleset;
see how easy it is in this screencast.
|
|
Running CodeNarc
Run CodeNarc with the Ant Task,
the command-line runner,
Docker, or
as part of your test suite.
Also, plugins exist for Maven,
Gradle, Grails,
SonarQube,
Visual Studio Code,
and Jenkins. See our
Integration page for more details.
Reports come in HTML, XML, or text format. Take a look at a
Sample CodeNarc HTML Report,
or a Sample CodeNarc XML Report.
|
Requirements
CodeNarc requires:
- Java 17 or later for the default CodeNarc artifact (Groovy 5); Java 1.8 or later for the Groovy 4-compatible variant
- Groovy 4.0 or later
- SLF4J API and binding jar(s)
- GMetrics 3.0.0 or later for CodeNarc 4.x.x; GMetrics-Groovy4 2.1.0 or later for CodeNarc 3.x.x, if using the Size/Complexity rules
|
Get it from Maven2
For projects built using Maven, CodeNarc is available
from the
Maven Central Repository
- groupId = org.codenarc
- artifactId = CodeNarc for the default (Groovy 5-compatible) artifact; CodeNarc-Groovy4 for the Groovy 4-compatible variant
- version = 4.x.x (same version number for both artifactIds)
|
Inspirations
We're inspired by the wonderful PMD
and Checkstyle Java static analysis tools, as well
as the extensive Groovy inspections performed by IntelliJ IDEA.
|