Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Gradle CodeNarc plug-in


May 25, 2021 Gradle


Table of contents


CodeNarc plug-in

The CodeNarc plug-in uses CodeNarc to perform quality checks and generate reports on the project's Groovy source files.

Usage

To use the CodeNarc plug-in, include the following statement in the build script:

Use the CodeNarc plug-in

build.gradle

apply plugin: 'codenarc'  

The plug-in adds a lot of quality checks to your project. You can perform a check by running the gradle check.

Task

The CodeNarc plug-in adds the following tasks to project:

Table 30.1. CodeNarc plug-in - task

The name of the task Depends on Type Describe
codenarcMain - codenarc Run CodeNarc for the production Groovy source file.
codenarcTest - codenarc Run CodeNarc against the test Groovy source file.
SourceSet - codenarc Run CodeNarc for the Groovy source file for a given source set.

The CodeNarc plug-in adds the following dependencies to the tasks that the Groovy plug-in joins.

Table 30.2. CodeNarc plug-in - Additional task dependency

The name of the task Depends on
check All CodeNarc tasks, codenarcTest

The project layout

The CodeNarc plug-in is expected to be the following project layout:

Table 30.3. CodeNarc plug-in - project layout

File Significance
config/codenarc/codenarc.xml CodeNarc profile

Rely on management

The CodeNarc plug-in adds the following dependency configurations:

Table 30.4. CodeNarc plug-in - Dependent on configuration

Name Significance
codenarc The CodeNarc library used