Package net.sourceforge.pmd.reporting
Class Report
- java.lang.Object
-
- net.sourceforge.pmd.reporting.Report
-
public final class Report extends Object
AReport
collects all information during a PMD execution. This includes violations, suppressed violations, metrics, error during processing and configuration errors.A report may be created by a
Report.GlobalReportBuilderListener
that you use as the GlobalAnalysisListener inPMD's entry point
. You can also create one manually withbuildReport(Consumer)
.For special use cases, like filtering the report after PMD analysis and before rendering the report, some transformation operations are provided:
These methods create a newReport
rather than modifying their receiver.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Report.ConfigurationError
Represents a configuration error.static class
Report.GlobalReportBuilderListener
AGlobalAnalysisListener
that accumulates the events of all files into aReport
.static class
Report.ProcessingError
Represents a processing error, such as a parse error.static class
Report.ReportBuilderListener
AFileAnalysisListener
that accumulates events into aReport
.static class
Report.SuppressedViolation
Represents a violation, that has been suppressed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Report
buildReport(Consumer<? super FileAnalysisListener> lambda)
Create a report by making side effects on aFileAnalysisListener
.Report
filterViolations(Predicate<RuleViolation> filter)
Creates a new report taking all the information from this report, but filtering the violations.List<Report.ConfigurationError>
getConfigurationErrors()
Returns an unmodifiable list of configuration errors that have been recorded until now.List<Report.ProcessingError>
getProcessingErrors()
Returns an unmodifiable list of processing errors that have been recorded until now.List<Report.SuppressedViolation>
getSuppressedViolations()
Returns an unmodifiable list of violations that were suppressed.List<RuleViolation>
getViolations()
Returns an unmodifiable list of violations that have been recorded until now.Report
union(Report other)
Creates a new report by combining this report with another report.
-
-
-
Method Detail
-
getSuppressedViolations
public List<Report.SuppressedViolation> getSuppressedViolations()
Returns an unmodifiable list of violations that were suppressed.
-
getViolations
public List<RuleViolation> getViolations()
Returns an unmodifiable list of violations that have been recorded until now. None of those violations were suppressed.The violations list is sorted with
RuleViolation.DEFAULT_COMPARATOR
.
-
getProcessingErrors
public List<Report.ProcessingError> getProcessingErrors()
Returns an unmodifiable list of processing errors that have been recorded until now.
-
getConfigurationErrors
public List<Report.ConfigurationError> getConfigurationErrors()
Returns an unmodifiable list of configuration errors that have been recorded until now.
-
buildReport
public static Report buildReport(Consumer<? super FileAnalysisListener> lambda)
Create a report by making side effects on aFileAnalysisListener
. This wraps aReport.ReportBuilderListener
.
-
filterViolations
public Report filterViolations(Predicate<RuleViolation> filter)
Creates a new report taking all the information from this report, but filtering the violations.- Parameters:
filter
- when true, the violation will be kept.- Returns:
- copy of this report
-
-