# The CodeNarc Plugin

version 7.6.4

The CodeNarc plugin performs quality checks on your project’s Groovy source files using CodeNarc and generates reports from these checks.

## Usage

To use the CodeNarc plugin, include the following in your build script:

Example 1. Using the CodeNarc plugin
build.gradle

    plugins {
        id 'codenarc'
    }

build.gradle.kts

    plugins {
        codenarc
    }

The plugin adds a number of tasks to the project that perform the quality checks when used with the Groovy Plugin. You can execute the checks by running `gradle check`.

## Tasks

The CodeNarc plugin adds the following tasks to the project:

`codenarcMain` — CodeNarc

  Runs CodeNarc against the production Groovy source files.

`codenarcTest` — CodeNarc

  Runs CodeNarc against the test Groovy source files.

`codenarcSourceSet` — CodeNarc

  Runs CodeNarc against the given source set’s Groovy source files.

### Dependencies added to other tasks

The CodeNarc plugin adds the following dependencies to tasks defined by the Groovy plugin.

`check`

  Depends on: All CodeNarc tasks, including `codenarcMain` and `codenarcTest`.

## Project layout

The CodeNarc plugin expects the following project layout:

    <root>
    └── config
        └── codenarc           (1)
            └── codenarc.xml   (2)

1 | CodeNarc configuration files go here
2 | Primary CodeNarc configuration file

## Dependency management

The CodeNarc plugin adds the following dependency configurations:

Table 1. CodeNarc plugin - dependency configurations
Name | Meaning
--- | ---
`codenarc` | The CodeNarc libraries to use

## Configuration

See the CodeNarcExtension class in the API documentation.