Fork me on GitHub

codenarc:check

Full name:

com.sciencesakura:codenarc-maven-plugin:1.0.1:check

Description:

Runs CodeNarc analysis on the project's source code. Call mvn codenarc:check to execute the analysis.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Binds by default to the lifecycle phase: verify.

Required Parameters

Name Type Since Description
<includes> List<String> - Specifies the file patterns to include in the analysis.
Default: **/*.groovy
User Property: codenarc.includes
<ruleset> String - Specifies the location of the CodeNarc ruleset file. If the default file does not exist, the plugin falls back to the built-in rulesets/basic.xml ruleset.
Default: ${project.basedir}/config/codenarc/codenarc.xml
User Property: codenarc.ruleset
<sourceDirectories> List<String> - Specifies the source directories to analyze. The plugin adds ${project.basedir}/src/main/groovy to this list if it exists and is not yet included.
Default: ${project.compileSourceRoots}

Optional Parameters

Name Type Since Description
<consoleOutput> boolean - Whether to output the analysis results to the console.
Default: false
User Property: codenarc.consoleOutput
<excludes> List<String> - Specifies the file patterns to exclude from the analysis.
User Property: codenarc.excludes
<failOnError> boolean - Whether to fail the build if an error occurs during analysis.
Default: true
User Property: codenarc.failOnError
<failOnViolation> boolean - Whether to fail the build if any violations are found.
Default: true
User Property: codenarc.failOnViolation
<includeTests> boolean - Whether to include test source directories in the analysis.
Default: false
User Property: codenarc.includeTests
<outputFile> File - Specifies the location of the CodeNarc report file. The report format is determined by the file extension:
  • .html or .htm for HTML
  • .json for JSON
  • .txt for plain text
  • any other extension for XML

Default: ${project.build.directory}/CodeNarcXmlReport.xml
User Property: codenarc.output.file
<testSourceDirectories> List<String> - Specifies the test source directories to analyze. The plugin adds ${project.basedir}/src/test/groovy to this list if it exists and is not yet included. This parameter is used only if includeTests is set to true.
Default: ${project.testCompileSourceRoots}

Parameter Details

<consoleOutput>

Whether to output the analysis results to the console.
  • Type: boolean
  • Required: No
  • User Property: codenarc.consoleOutput
  • Default: false

<excludes>

Specifies the file patterns to exclude from the analysis.
  • Type: java.util.List<java.lang.String>
  • Required: No
  • User Property: codenarc.excludes

<failOnError>

Whether to fail the build if an error occurs during analysis.
  • Type: boolean
  • Required: No
  • User Property: codenarc.failOnError
  • Default: true

<failOnViolation>

Whether to fail the build if any violations are found.
  • Type: boolean
  • Required: No
  • User Property: codenarc.failOnViolation
  • Default: true

<includeTests>

Whether to include test source directories in the analysis.
  • Type: boolean
  • Required: No
  • User Property: codenarc.includeTests
  • Default: false

<includes>

Specifies the file patterns to include in the analysis.
  • Type: java.util.List<java.lang.String>
  • Required: Yes
  • User Property: codenarc.includes
  • Default: **/*.groovy

<outputFile>

Specifies the location of the CodeNarc report file. The report format is determined by the file extension:
  • .html or .htm for HTML
  • .json for JSON
  • .txt for plain text
  • any other extension for XML
  • Type: java.io.File
  • Required: No
  • User Property: codenarc.output.file
  • Default: ${project.build.directory}/CodeNarcXmlReport.xml

<ruleset>

Specifies the location of the CodeNarc ruleset file. If the default file does not exist, the plugin falls back to the built-in rulesets/basic.xml ruleset.
  • Type: java.lang.String
  • Required: Yes
  • User Property: codenarc.ruleset
  • Default: ${project.basedir}/config/codenarc/codenarc.xml

<sourceDirectories>

Specifies the source directories to analyze. The plugin adds ${project.basedir}/src/main/groovy to this list if it exists and is not yet included.
  • Type: java.util.List<java.lang.String>
  • Required: Yes
  • Default: ${project.compileSourceRoots}

<testSourceDirectories>

Specifies the test source directories to analyze. The plugin adds ${project.basedir}/src/test/groovy to this list if it exists and is not yet included. This parameter is used only if includeTests is set to true.
  • Type: java.util.List<java.lang.String>
  • Required: No
  • Default: ${project.testCompileSourceRoots}