class CodeNarcRunner extends java.lang.Object
Helper class to run CodeNarc.
The following properties must be configured before invoking theexecute()
method:
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.sourceAnalyzer
- An instance of a org.codenarc.analyzer.SourceAnalyzer
implementation.reportWriters
- The list of ReportWriter
instances. A report is generated
for each element in this list. At least one ReportWriter
must be configured.Modifiers | Name | Description |
---|---|---|
static java.lang.String |
PLUGINS_PROPERTY |
|
static java.lang.String |
STANDARD_PLUGIN_CLASSES |
|
protected java.util.List<CodeNarcPlugin> |
plugins |
|
protected RuleSetConfigurer |
ruleSetConfigurer |
Type | Name and description |
---|---|
java.lang.String |
propertiesFilename |
java.util.List<ReportWriter> |
reportWriters |
java.lang.String |
ruleSetFiles |
java.lang.String |
ruleSetString |
SourceAnalyzer |
sourceAnalyzer |
Constructor and description |
---|
CodeNarcRunner
() |
Type Params | Return Type | Name and description |
---|---|---|
|
protected RuleSet |
createInitialRuleSet() Create and return the RuleSet that provides the source of Rules to be applied. |
|
Results |
execute() The main entry point for this class. |
|
java.util.List<CodeNarcPlugin> |
getPlugins() |
|
void |
registerPlugin(CodeNarcPlugin plugin) |
|
void |
registerPluginsForClassNames(java.lang.String pluginClassNames) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Create and return the RuleSet that provides the source of Rules to be applied. The returned RuleSet may aggregate multiple underlying RuleSets.
The main entry point for this class. Runs CodeNarc and returns the results. Processing steps include:
ruleSetFiles
or ruleSetString
property to create a RuleSet.
- ruleSetFiles: Each path may be optionally prefixed by
any of the valid java.net.URL prefixes, such as "file:" (to load from a relative or absolute filesystem path),
or "http:". If it is a URL, its path may be optionally URL-encoded. That can be useful if the path contains
any problematic characters, such as comma (',') or hash ('#'). See URLEncoder#encode(java.lang.String, java.lang.String).
- ruleSetString: string containing a ruleSet in JSON format (if set, ruleSetFiles will be ignored)
SourceAnalyzer
.ReportWriter
.Results
object representing the analysis results.Results
object containing the results of the CodeNarc analysis.Groovy Documentation