class CodeNarcTask extends org.apache.tools.ant.Task
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
specify the
thresholds for violations of priority 2 and 3.
The failOnError
property indicates whether to terminate and fail the task if any errors
occur parsing source files (true), or just log the errors (false). It defaults to false.
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
The option
elements, with name
, and
value
attributes.
plugins
optional property is the list of CodeNarcPlugin class names to register, separated by commas.
Modifiers | Name | Description |
---|---|---|
protected groovy.lang.Closure |
createCodeNarcRunner |
|
protected java.util.List |
fileSets |
|
protected java.util.List |
reportWriters |
|
protected RuleSet |
ruleSet |
Type | Name and description |
---|---|
org.apache.tools.ant.types.Path |
classpath Classpath used when compiling analysed classes. |
java.lang.String |
excludeBaseline The path to a Baseline Violations report (report type "baseline"). |
boolean |
failOnError Whether to terminate and fail the task if errors occur parsing source files (true), or just log the errors (false) |
int |
maxPriority1Violations |
int |
maxPriority2Violations |
int |
maxPriority3Violations |
java.lang.String |
plugins The optional list of CodeNarcPlugin class names to register, separated by commas. |
java.lang.String |
ruleSetFiles The path to the Groovy or XML RuleSet definition files, relative to the classpath. |
Constructor and description |
---|
CodeNarcTask
() |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
addConfiguredReport(Report report) Ant-defined method (by convention), called with each instance of a nested |
|
void |
addFileset(org.apache.tools.ant.types.FileSet fileSet) |
|
org.apache.tools.ant.types.Path |
createClasspath() |
|
protected SourceAnalyzer |
createSourceAnalyzer() Create and return the SourceAnalyzer |
|
void |
execute() Execute this Ant Task |
|
void |
setClasspathRef(groovy.lang.Reference reference) Adds a reference to a classpath defined elsewhere to be used when compiling analysed classes. |
Methods inherited from class | Name |
---|---|
class org.apache.tools.ant.Task |
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#setTaskName(java.lang.String), 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#setOwningTarget(org.apache.tools.ant.Target), org.apache.tools.ant.Task#getRuntimeConfigurableWrapper(), org.apache.tools.ant.Task#setRuntimeConfigurableWrapper(org.apache.tools.ant.RuntimeConfigurable), org.apache.tools.ant.Task#maybeConfigure(), 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.Throwable, int), 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#setDescription(java.lang.String), org.apache.tools.ant.Task#getProject(), org.apache.tools.ant.Task#setProject(org.apache.tools.ant.Project), org.apache.tools.ant.Task#setLocation(org.apache.tools.ant.Location), org.apache.tools.ant.Task#getDescription(), org.apache.tools.ant.Task#clone(), org.apache.tools.ant.Task#getLocation(), org.apache.tools.ant.Task#wait(long, int), org.apache.tools.ant.Task#wait(long), org.apache.tools.ant.Task#wait(), 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() |
Classpath used when compiling analysed classes.
The path to a Baseline Violations report (report type "baseline"). If set, then all violations specified within that report are excluded (filtered) from the current CodeNarc run. If null/empty, then do nothing.
Whether to terminate and fail the task if errors occur parsing source files (true), or just log the errors (false)
The optional list of CodeNarcPlugin class names to register, separated by commas.
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.
Ant-defined method (by convention), called with each instance of a nested
Create and return the SourceAnalyzer
Execute this Ant Task
Adds a reference to a classpath defined elsewhere to be used when compiling analysed classes.
Groovy Documentation