|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
javancss.JavancssAntTask
public class JavancssAntTask
Ant task to report and check basic code metrics.
This task wraps the JavaNCSS library for determining code metrics. The library determines several code metrics such as object counts, non-commented source statements (NCSS), cyclomatic complexity numbers (CCN), and javadoc statements. These counts are subtotaled per function, class, and package. This task allows you to place minimum and maximum thresholds on each of these (not all of these make sense but all are included for completeness).
The original version of this task was written by Steve Jernigan and made available on SourceForge as the JavaNCSS2Ant project. It was subsequently extended by Phillip Wells to enable access to the report generation feature of the tool whereupon it was submitted for inclusion in Ant itself.
JavaNCSS was developed by Christoph Clemens Lee and is available here.
Field Summary |
---|
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
---|
fileset |
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
JavancssAntTask()
Creates a new instance of the task. |
Method Summary | |
---|---|
org.apache.tools.ant.types.Path |
createClasspath()
Maybe creates a nested classpath element. |
void |
execute()
Executes this task. |
void |
setAbortOnFail(boolean abortOnFail)
Sets whether the build should halt if there is an error or a threshold is exceeded. |
void |
setCcnPerFuncMax(int ccnPerFuncMax)
Sets the maximum value of the Cyclomatic Complexity Number per function. |
void |
setCcnPerFuncMin(int ccnPerFuncMin)
Sets the minimum value of the Cyclomatic Complexity Number per function. |
void |
setClassMetrics(boolean classMetrics)
Whether class/interface metrics should be generated. |
void |
setClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath to be used. |
void |
setClassPerClassMax(int classPerClassMax)
Sets the maximum number of inner classes per class. |
void |
setClassPerClassMin(int classPerClassMin)
Sets the minimum number of inner classes per class. |
void |
setClassPerPkgMax(int classPerPkgMax)
Sets the maximum number of classes per package. |
void |
setClassPerPkgMin(int classPerPkgMin)
Sets the minimum number of classes per package. |
void |
setFormat(String format)
Sets the format of the output file. |
void |
setFuncPerClassMax(int funcPerClassMax)
Sets the maximum number of functions per class. |
void |
setFuncPerClassMin(int funcPerClassMin)
Sets the minimum number of functions per class. |
void |
setFuncPerPkgMax(int funcPerPkgMax)
Sets the maximum number of functions per package. |
void |
setFuncPerPkgMin(int funcPerPkgMin)
Sets the minimum number of functions per package. |
void |
setFunctionMetrics(boolean functionMetrics)
Whether function metrics should be generated. |
void |
setGenerateReport(boolean generateReport)
Whether a report should be generated. |
void |
setJvdcPerClassMax(int jvdcPerClassMax)
Sets the maximum number of javadoc comments per class. |
void |
setJvdcPerClassMin(int jvdcPerClassMin)
Sets the minimum number of javadoc comments per class. |
void |
setJvdcPerFuncMax(int jvdcPerFuncMax)
Sets the maximum number of javadoc comments per function. |
void |
setJvdcPerFuncMin(int jvdcPerFuncMin)
Sets the minimum number of javadoc comments per function. |
void |
setNcssPerClassMax(int ncssPerClassMax)
Sets the maximum number of non-commenting source statements per class. |
void |
setNcssPerClassMin(int ncssPerClassMin)
Sets the minimum number of non-commenting source statements per class. |
void |
setNcssPerFuncMax(int ncssPerFuncMax)
Sets the maximum number of non-commenting source statements per function. |
void |
setNcssPerFuncMin(int ncssPerFuncMin)
Sets the minimum number of non-commenting source statements per function. |
void |
setNcssPerPkgMax(int ncssPerPkgMax)
Sets the maximum number of non-commenting source statements per package. |
void |
setNcssPerPkgMin(int ncssPerPkgMin)
Sets the minimum number of non-commenting source statements per package. |
void |
setOutputfile(File outputfile)
Sets the location of the output file. |
void |
setPackageMetrics(boolean packageMetrics)
Whether package metrics should be generated. |
void |
setSrcdir(File srcdir)
Sets the directory to be scanned by the tool. |
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
---|
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavancssAntTask()
Method Detail |
---|
public void setFormat(String format)
format
- the format of the output file. Allowable values are 'plain'
or 'xml'.public void setPackageMetrics(boolean packageMetrics)
packageMetrics
- true if they should; false otherwise.public void setClassMetrics(boolean classMetrics)
classMetrics
- true if they should; false otherwise.public void setFunctionMetrics(boolean functionMetrics)
functionMetrics
- true if they should; false otherwise.public void setGenerateReport(boolean generateReport)
generateReport
- true if they should; false otherwise.public void setSrcdir(File srcdir)
srcdir
- the directory to be scanned by the tool.public void setOutputfile(File outputfile)
outputfile
- the location of the output file.public void setClasspath(org.apache.tools.ant.types.Path classpath)
classpath
- the classpath to be used.public void setAbortOnFail(boolean abortOnFail)
abortOnFail
- true if it should; false otherwise.public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- if an error occurs.public org.apache.tools.ant.types.Path createClasspath()
public void setClassPerPkgMax(int classPerPkgMax)
classPerPkgMax
- the maximum number of classes per package.public void setClassPerPkgMin(int classPerPkgMin)
classPerPkgMin
- the minimum number of classes per package.public void setFuncPerPkgMax(int funcPerPkgMax)
funcPerPkgMax
- the maximum number of functions per package.public void setFuncPerPkgMin(int funcPerPkgMin)
funcPerPkgMin
- the minimum number of functions per package.public void setNcssPerPkgMax(int ncssPerPkgMax)
ncssPerPkgMax
- the maximum number of non-commenting source
statements per package.public void setNcssPerPkgMin(int ncssPerPkgMin)
ncssPerPkgMin
- the minimum number of non-commenting source
statements per package.public void setClassPerClassMax(int classPerClassMax)
classPerClassMax
- the maximum number of inner classes per class.public void setClassPerClassMin(int classPerClassMin)
classPerClassMin
- the minimum number of inner classes per class.public void setFuncPerClassMax(int funcPerClassMax)
funcPerClassMax
- the maximum number of functions per class.public void setFuncPerClassMin(int funcPerClassMin)
funcPerClassMin
- the minimum number of functions per class.public void setNcssPerClassMax(int ncssPerClassMax)
ncssPerClassMax
- the maximum number of non-commenting source
statements per class.public void setNcssPerClassMin(int ncssPerClassMin)
ncssPerClassMin
- the minimum number of non-commenting source
statements per class.public void setJvdcPerClassMax(int jvdcPerClassMax)
jvdcPerClassMax
- the maximum number of javadoc comments per class.public void setJvdcPerClassMin(int jvdcPerClassMin)
jvdcPerClassMin
- the minimum number of javadoc comments per class.public void setCcnPerFuncMax(int ccnPerFuncMax)
ccnPerFuncMax
- the maximum value of the Cyclomatic Complexity Number
per function.public void setCcnPerFuncMin(int ccnPerFuncMin)
ccnPerFuncMin
- the minimum value of the Cyclomatic Complexity Number
per function.public void setNcssPerFuncMax(int ncssPerFuncMax)
ncssPerFuncMax
- the maximum number of non-commenting source
statements per function.public void setNcssPerFuncMin(int ncssPerFuncMin)
ncssPerFuncMin
- the minimum number of non-commenting source
statements per function.public void setJvdcPerFuncMax(int jvdcPerFuncMax)
jvdcPerFuncMax
- the maximum number of javadoc comments per function.public void setJvdcPerFuncMin(int jvdcPerFuncMin)
jvdcPerFuncMin
- the minimum number of javadoc comments per function.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |