Package org.codenarc.ant
Class AntFileSetSourceAnalyzer
- java.lang.Object
-
- org.codenarc.analyzer.AbstractSourceAnalyzer
-
- org.codenarc.ant.AntFileSetSourceAnalyzer
-
- All Implemented Interfaces:
groovy.lang.GroovyObject,SourceAnalyzer
public class AntFileSetSourceAnalyzer extends AbstractSourceAnalyzer
SourceAnalyzer implementation that gets source files from one or more Ant FileSets.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.atomic.AtomicInteger>fileCountMapprotected java.util.List<org.apache.tools.ant.types.FileSet>fileSetsprivate static org.slf4j.LoggerLOGprivate static intPOOL_TIMEOUT_SECONDSprivate org.apache.tools.ant.Projectprojectprivate java.util.concurrent.ConcurrentMap<java.lang.String,java.util.List<FileResults>>resultsMap
-
Constructor Summary
Constructors Constructor Description AntFileSetSourceAnalyzer(org.apache.tools.ant.Project project, java.util.List<org.apache.tools.ant.types.FileSet> fileSets)Construct a new instance on the specified List of Ant FileSets.AntFileSetSourceAnalyzer(org.apache.tools.ant.Project project, org.apache.tools.ant.types.FileSet fileSet)Construct a new instance on the specified Ant FileSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddDirectoryResults(DirectoryResults reportResults)private voidaddToParentResults(DirectoryResults reportResults, Results results)private voidaddToResultsMap(java.lang.String parentPath, FileResults results)Resultsanalyze(RuleSet ruleSet)Analyze all source code using the specified RuleSet and return the report results.private java.lang.RunnablebuildTask(java.io.File baseDir, java.lang.String filePath, RuleSet ruleSet)java.util.ListgetSourceDirectories()private voidincrementFileCount(java.lang.String parentPath)private voidprocessFile(java.io.File baseDir, java.lang.String filePath, RuleSet ruleSet)private voidprocessFileSet(org.apache.tools.ant.types.FileSet fileSet, RuleSet ruleSet, java.util.concurrent.ExecutorService pool)-
Methods inherited from class org.codenarc.analyzer.AbstractSourceAnalyzer
collectViolations, getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty
-
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
POOL_TIMEOUT_SECONDS
private static final int POOL_TIMEOUT_SECONDS
- See Also:
- Constant Field Values
-
project
private final org.apache.tools.ant.Project project
-
fileSets
protected final java.util.List<org.apache.tools.ant.types.FileSet> fileSets
-
resultsMap
private final java.util.concurrent.ConcurrentMap<java.lang.String,java.util.List<FileResults>> resultsMap
-
fileCountMap
private final java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.atomic.AtomicInteger> fileCountMap
-
-
Constructor Detail
-
AntFileSetSourceAnalyzer
public AntFileSetSourceAnalyzer(org.apache.tools.ant.Project project, org.apache.tools.ant.types.FileSet fileSet)Construct a new instance on the specified Ant FileSet.- Parameters:
project- - the Ant Project; must not be nullfileSet- - the Ant FileSet; must not be null
-
AntFileSetSourceAnalyzer
AntFileSetSourceAnalyzer(org.apache.tools.ant.Project project, java.util.List<org.apache.tools.ant.types.FileSet> fileSets)Construct a new instance on the specified List of Ant FileSets.- Parameters:
project- - the Ant ProjectfileSets- - the List of Ant FileSet; my be empty; must not be null
-
-
Method Detail
-
analyze
public Results analyze(RuleSet ruleSet)
Analyze all source code using the specified RuleSet and return the report results.- Parameters:
ruleSet- - the RuleSet to apply to each source component; must not be null.- Returns:
- the results from applying the RuleSet to all of the source
-
getSourceDirectories
public java.util.List getSourceDirectories()
-
processFileSet
private void processFileSet(org.apache.tools.ant.types.FileSet fileSet, RuleSet ruleSet, java.util.concurrent.ExecutorService pool)
-
buildTask
private java.lang.Runnable buildTask(java.io.File baseDir, java.lang.String filePath, RuleSet ruleSet)
-
processFile
private void processFile(java.io.File baseDir, java.lang.String filePath, RuleSet ruleSet)
-
incrementFileCount
private void incrementFileCount(java.lang.String parentPath)
-
addToResultsMap
private void addToResultsMap(java.lang.String parentPath, FileResults results)
-
addToParentResults
private void addToParentResults(DirectoryResults reportResults, Results results)
-
addDirectoryResults
private void addDirectoryResults(DirectoryResults reportResults)
-
-