The CodeNarc plugin performs quality checks on your project's Groovy source files using CodeNarc and generates reports from these checks.
To use the CodeNarc plugin, include the following in your build script:
The plugin adds a number of tasks to the project that perform the quality checks. You can execute the checks by running gradle check
.
The CodeNarc plugin adds the following tasks to the project:
Table 30.1. CodeNarc plugin - tasks
The CodeNarc plugin adds the following dependencies to tasks defined by the Groovy plugin.
Table 30.2. CodeNarc plugin - additional task dependencies
Task name | Depends on |
check |
All CodeNarc tasks, including codenarcMain and codenarcTest . |
The CodeNarc plugin expects the following project layout:
Table 30.3. CodeNarc plugin - project layout
File | Meaning |
config/codenarc/codenarc.xml
|
CodeNarc configuration file |
The CodeNarc plugin adds the following dependency configurations:
Table 30.4. CodeNarc plugin - dependency configurations
Name | Meaning |
codenarc
|
The CodeNarc libraries to use |
See the CodeNarcExtension
class in the API documentation.