The CodeNarc project provides a static analysis tool for Groovy code.


License
Apache-2.0

Documentation

CodeNarc Logo

Maven Central Build Status GitHub contributors GitHub stars License PRs Welcome

CodeNarc is a static analysis tool for Groovy source code, enabling monitoring and enforcement of many coding standards and best practices. CodeNarc applies a set of Rules (predefined and/or custom) that are applied to each Groovy file, and generates an HTML or XML report of the results, including a list of rules violated for each source file, and a count of the number of violations per package and for the whole project.

CodeNarc is similar to popular static analysis tools such as PMD or Checkstyle. Unlike those tools which analyze Java code, CodeNarc analyzes Groovy code.

DOCUMENTATION

All documentation is available on CodeNarc website

List of tools and IDEs integrating CodeNarc out of the box is available here

DEPENDENCIES

CodeNarc requires

  • Groovy version 3.0 or later
  • The SLF4J api/implementation jars, accessible on the CLASSPATH.
  • The GMetrics jar, version 2.0.0 or later; only needed if using some size/complexity rules.

AVAILABLE FROM MAVEN CENTRAL REPOSITORY

For projects built using Gradle or Maven, CodeNarc is available from the Maven Central Repository.

  • groupId = org.codenarc
  • artifactId = CodeNarc

BUILD

To build the CodeNarc jar from source, run the following command:

./gradlew jar

DEVELOPMENT

When contributing to CodeNarc, run the following command to test on your local machine:

./gradlew check

It is recommended to use Java 8-11.