Package net.sourceforge.pmd.reporting
Class Report
- java.lang.Object
-
- net.sourceforge.pmd.reporting.Report
-
public final class Report extends Object
AReportcollects all information during a PMD execution. This includes violations, suppressed violations, metrics, recoverable errors (that occurred during processing) and configuration errors.A report may be created by a
Report.GlobalReportBuilderListenerthat 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 newReportrather than modifying their receiver.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReport.ConfigurationErrorRepresents a configuration error for a specific rule.static classReport.GlobalReportBuilderListenerAGlobalAnalysisListenerthat accumulates the events of all files into aReport.static classReport.ProcessingErrorRepresents a recovered error that occurred during analysis.static classReport.ReportBuilderListenerAFileAnalysisListenerthat accumulates events into aReport.static classReport.SuppressedViolationRepresents a violation, that has been suppressed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ReportbuildReport(Consumer<? super FileAnalysisListener> lambda)Create a report by making side effects on aFileAnalysisListener.ReportfilterViolations(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.Reportunion(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
-
-