Class Report


  • public class Report
    extends Object
    A Report collects all informations during a PMD execution. This includes violations, suppressed violations, metrics, error during processing and configuration errors.
    • Constructor Detail

      • Report

        public Report()
    • Method Detail

      • createReport

        public static Report createReport​(RuleContext ctx,
                                          String fileName)
        Creates a new, initialized, empty report for the given file name.
        Parameters:
        ctx - The context to use to connect to the report
        fileName - the filename used to report any violations
        Returns:
        the new report
      • addRuleViolation

        public void addRuleViolation​(RuleViolation violation)
        Adds a new rule violation to the report and notify the listeners.
        Parameters:
        violation - the violation to add
      • addConfigError

        public void addConfigError​(Report.ConfigurationError error)
        Adds a new configuration error to the report.
        Parameters:
        error - the error to add
      • addError

        public void addError​(Report.ProcessingError error)
        Adds a new processing error to the report.
        Parameters:
        error - the error to add
      • merge

        public void merge​(Report r)
        Merges the given report into this report. This might be necessary, if a summary over all violations is needed as PMD creates one report per file by default.

        This is synchronized on an internal lock (note that other mutation operations are not synchronized, todo for pmd 7).

        Parameters:
        r - the report to be merged into this.
        See Also:
        AbstractAccumulatingRenderer
      • getSuppressedViolations

        public final List<Report.SuppressedViolation> getSuppressedViolations()
        Returns an unmodifiable list of violations that were suppressed.
      • getViolations

        public final 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 final List<Report.ProcessingError> getProcessingErrors()
        Returns an unmodifiable list of processing errors that have been recorded until now.
      • getConfigurationErrors

        public final List<Report.ConfigurationError> getConfigurationErrors()
        Returns an unmodifiable list of configuration errors that have been recorded until now.