Package: groovy.org.codenarc.ant

## [Groovy] Class CodeNarcTask

- groovy.org.codenarc.ant.CodeNarcTask

- Ant Task for running CodeNarc.

  The `ruleSetFiles` property specifies the path to the Groovy or XML RuleSet definition files, relative to the classpath. This can be a single file path, or multiple paths separated by commas. It is required.

  The `maxPriority1Violations` property specifies the maximum number of priority 1 violations allowed before failing the build (throwing a BuildException). Likewise, `maxPriority2Violations` and `maxPriority3Violations` specifiy the thresholds for violations of priority 2 and 3.

  At least one nested `fileset` element is required, and is used to specify the source files to be analyzed. This is the standard Ant FileSet, and is quite powerful and flexible. See the Apache Ant Manual for more information on FileSets.

  The <ode>report nested element defines the format and output file for the analysis report. Currently, HTML (type="html") and XML (type="xml") are the only supported formats. Each report is configured using nested `option` elements, with `name`, and `value` attributes.
  See Also:
  Authors:
    Chris Mair

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected def` | `createCodeNarcRunner` |
    `protected List` | `fileSets` |
    `protected List` | `reportWriters` |
    `protected def` | `ruleSet` |

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `int` | `maxPriority1Violations`
    `int` | `maxPriority2Violations`
    `int` | `maxPriority3Violations`
    `String` | `ruleSetFiles` The path to the Groovy or XML RuleSet definition files, relative to the classpath.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `addConfiguredReport(Report report)` Ant-defined method (by convention), called with each instance of a nested <report> element within this task.
    `` | `void` | `addFileset(org.apache.tools.ant.types.FileSet fileSet)`
    `` | `protected SourceAnalyzer` | `createSourceAnalyzer()` Create and return the SourceAnalyzer
    `` | `void` | `execute()` Execute this Ant Task

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---

    `class org.apache.tools.ant.Task`

    `org.apache.tools.ant.Task#log(java.lang.Throwable, int), org.apache.tools.ant.Task#log(java.lang.String, int), org.apache.tools.ant.Task#log(java.lang.String), org.apache.tools.ant.Task#log(java.lang.String, java.lang.Throwable, int), org.apache.tools.ant.Task#init(), org.apache.tools.ant.Task#execute(), org.apache.tools.ant.Task#maybeConfigure(), org.apache.tools.ant.Task#getTaskName(), org.apache.tools.ant.Task#getOwningTarget(), org.apache.tools.ant.Task#getTaskType(), org.apache.tools.ant.Task#setTaskType(java.lang.String), org.apache.tools.ant.Task#setTaskName(java.lang.String), org.apache.tools.ant.Task#setOwningTarget(org.apache.tools.ant.Target), org.apache.tools.ant.Task#getRuntimeConfigurableWrapper(), org.apache.tools.ant.Task#reconfigure(), org.apache.tools.ant.Task#perform(), org.apache.tools.ant.Task#bindToOwner(org.apache.tools.ant.Task), org.apache.tools.ant.Task#setRuntimeConfigurableWrapper(org.apache.tools.ant.RuntimeConfigurable), org.apache.tools.ant.Task#clone(), org.apache.tools.ant.Task#getLocation(), org.apache.tools.ant.Task#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.Task#getDescription(), org.apache.tools.ant.Task#getProject(), org.apache.tools.ant.Task#setDescription(java.lang.String), org.apache.tools.ant.Task#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.Task#equals(java.lang.Object), org.apache.tools.ant.Task#toString(), org.apache.tools.ant.Task#hashCode(), org.apache.tools.ant.Task#getClass(), org.apache.tools.ant.Task#notify(), org.apache.tools.ant.Task#notifyAll(), org.apache.tools.ant.Task#wait(long), org.apache.tools.ant.Task#wait(long, int), org.apache.tools.ant.Task#wait()`

    `class org.apache.tools.ant.ProjectComponent`

    `org.apache.tools.ant.ProjectComponent#clone(), org.apache.tools.ant.ProjectComponent#log(java.lang.String), org.apache.tools.ant.ProjectComponent#log(java.lang.String, int), org.apache.tools.ant.ProjectComponent#getLocation(), org.apache.tools.ant.ProjectComponent#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.ProjectComponent#getDescription(), org.apache.tools.ant.ProjectComponent#getProject(), org.apache.tools.ant.ProjectComponent#setDescription(java.lang.String), org.apache.tools.ant.ProjectComponent#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.ProjectComponent#equals(java.lang.Object), org.apache.tools.ant.ProjectComponent#toString(), org.apache.tools.ant.ProjectComponent#hashCode(), org.apache.tools.ant.ProjectComponent#getClass(), org.apache.tools.ant.ProjectComponent#notify(), org.apache.tools.ant.ProjectComponent#notifyAll(), org.apache.tools.ant.ProjectComponent#wait(long), org.apache.tools.ant.ProjectComponent#wait(long, int), org.apache.tools.ant.ProjectComponent#wait()`

- - ### Field Detail

    - #### protected def createCodeNarcRunner

    - #### protected List fileSets

    - #### protected List reportWriters

    - #### protected def ruleSet

  - ### Property Detail

    - #### int maxPriority1Violations

    - #### int maxPriority2Violations

    - #### int maxPriority3Violations

    - #### String ruleSetFiles

      The path to the Groovy or XML RuleSet definition files, relative to the classpath. This can be a single file path, or multiple paths separated by commas.

  - ### Method Detail

    - #### void addConfiguredReport(Report report)

      Ant-defined method (by convention), called with each instance of a nested <report> element within this task.

    - #### void addFileset(org.apache.tools.ant.types.FileSet fileSet)

    - #### protected SourceAnalyzer createSourceAnalyzer()

      Create and return the SourceAnalyzer

      Returns:
        a configured SourceAnalyzer instance

    - #### void execute()

      Execute this Ant Task