public class Report extends Object implements Iterable<RuleViolation>
Report
collects all informations during a PMD execution. This
includes violations, suppressed violations, metrics, error during processing
and configuration errors.Modifier and Type | Class and Description |
---|---|
static class |
Report.ProcessingError
Represents a processing error, such as a parse error.
|
static class |
Report.ReadableDuration
Represents a duration.
|
static class |
Report.RuleConfigurationError
Represents a configuration error.
|
static class |
Report.SuppressedViolation
Represents a violation, that has been suppressed.
|
Constructor and Description |
---|
Report() |
Modifier and Type | Method and Description |
---|---|
void |
addConfigError(Report.RuleConfigurationError error)
Adds a new configuration error to the report.
|
void |
addError(Report.ProcessingError error)
Adds a new processing error to the report.
|
void |
addListener(ReportListener listener)
Registers a report listener
|
void |
addMetric(Metric metric)
Adds a new metric to the report and notify the listeners
|
void |
addRuleViolation(RuleViolation violation)
Adds a new rule violation to the report and notify the listeners.
|
void |
addSynchronizedListeners(List<SynchronizedReportListener> synchronizedListeners)
Adds all given listeners to this report
|
Iterator<Report.RuleConfigurationError> |
configErrors()
Returns an iterator of the reported configuration errors.
|
static Report |
createReport(RuleContext ctx,
String fileName)
Creates a new, initialized, empty report for the given file name.
|
void |
end()
Mark the end time of the report.
|
Iterator<Report.ProcessingError> |
errors()
Returns an iterator of the reported processing errors.
|
Map<String,Integer> |
getCountSummary()
Calculate a summary of violation counts per fully classified class name.
|
long |
getElapsedTimeInMillis() |
Map<String,Integer> |
getSummary()
Calculate a summary of violations per rule.
|
List<Report.SuppressedViolation> |
getSuppressedRuleViolations() |
List<SynchronizedReportListener> |
getSynchronizedListeners() |
ReportTree |
getViolationTree() |
boolean |
hasConfigErrors()
Checks whether any configuration errors have been reported.
|
boolean |
hasErrors()
Checks whether any processing errors have been reported.
|
boolean |
hasMetrics()
Check whether any metrics have been reported
|
boolean |
isEmpty() |
Iterator<RuleViolation> |
iterator() |
void |
merge(Report r)
Merges the given report into this report.
|
Iterator<Metric> |
metrics()
Iterate over the metrics.
|
int |
size()
The number of violations.
|
void |
start()
Mark the start time of the report.
|
void |
suppress(Map<Integer,String> lines)
Configure the lines, that are suppressed via a NOPMD comment.
|
boolean |
treeIsEmpty()
Checks whether no violations have been reported.
|
Iterator<RuleViolation> |
treeIterator()
Returns an iteration over the reported violations.
|
int |
treeSize()
The number of violations.
|
public static Report createReport(RuleContext ctx, String fileName)
ctx
- The context to use to connect to the reportfileName
- the filename used to report any violationspublic void suppress(Map<Integer,String> lines)
lines
- the suppressed linespublic Map<String,Integer> getCountSummary()
public ReportTree getViolationTree()
public Map<String,Integer> getSummary()
public void addListener(ReportListener listener)
listener
- the listenerpublic List<Report.SuppressedViolation> getSuppressedRuleViolations()
public void addRuleViolation(RuleViolation violation)
violation
- the violation to addpublic void addMetric(Metric metric)
metric
- the metric to addpublic void addConfigError(Report.RuleConfigurationError error)
error
- the error to addpublic void addError(Report.ProcessingError error)
error
- the error to addpublic void merge(Report r)
r
- the report to be merged into this.AbstractAccumulatingRenderer
public boolean hasMetrics()
true
if there are metrics, false
otherwisepublic Iterator<Metric> metrics()
public boolean isEmpty()
public boolean hasErrors()
true
if there were any processing errors,
false
otherwisepublic boolean hasConfigErrors()
true
if there were any configuration errors,
false
otherwisepublic boolean treeIsEmpty()
true
if no violations have been reported,
false
otherwisepublic Iterator<RuleViolation> treeIterator()
public Iterator<RuleViolation> iterator()
iterator
in interface Iterable<RuleViolation>
public Iterator<Report.ProcessingError> errors()
public Iterator<Report.RuleConfigurationError> configErrors()
public int treeSize()
public int size()
public void start()
getElapsedTimeInMillis()
public void end()
getElapsedTimeInMillis()
public long getElapsedTimeInMillis()
public List<SynchronizedReportListener> getSynchronizedListeners()
public void addSynchronizedListeners(List<SynchronizedReportListener> synchronizedListeners)
synchronizedListeners
- the report listenersCopyright © 2002-2015 InfoEther. All Rights Reserved.