Class Report

    • Constructor Detail

      • Report

        @Deprecated
        @InternalApi
        public Report()
        Deprecated.
        Report instances are created by PMD. There is no need to create a own report. This constructor will be hidden in PMD7.
    • Method Detail

      • createReport

        @Deprecated
        @InternalApi
        public static Report createReport​(RuleContext ctx,
                                          String fileName)
        Deprecated.
        Is internal API
        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
      • suppress

        public void suppress​(Map<Integer,​String> lines)
        Configure the lines, that are suppressed via a NOPMD comment.
        Parameters:
        lines - the suppressed lines
      • getCountSummary

        @Deprecated
        public Map<String,​Integer> getCountSummary()
        Deprecated.
        This is too specific. Not every violation has a qualified name.
        Calculate a summary of violation counts per fully classified class name.
        Returns:
        violations per class name
      • getSummary

        @Deprecated
        public Map<String,​Integer> getSummary()
        Deprecated.
        This is too specific, only used by one renderer.
        Calculate a summary of violations per rule.
        Returns:
        a Map summarizing the Report: String (rule name) -> Integer (count of violations)
      • addRuleViolation

        @Deprecated
        @InternalApi
        public void addRuleViolation​(RuleViolation violation)
        Deprecated.
        PMD's way of creating a report is internal and may be changed in pmd 7.
        Adds a new rule violation to the report and notify the listeners.
        Parameters:
        violation - the violation to add
      • addMetric

        @Deprecated
        public void addMetric​(Metric metric)
        Deprecated.
        Adds a new metric to the report and notify the listeners
        Parameters:
        metric - the metric to add
      • addConfigError

        @Deprecated
        @InternalApi
        public void addConfigError​(Report.ConfigurationError error)
        Deprecated.
        PMD's way of creating a report is internal and may be changed in pmd 7.
        Adds a new configuration error to the report.
        Parameters:
        error - the error to add
      • addError

        @Deprecated
        @InternalApi
        public void addError​(Report.ProcessingError error)
        Deprecated.
        PMD's way of creating a report is internal and may be changed in pmd 7.
        Adds a new processing error to the report.
        Parameters:
        error - the error to add
      • merge

        @Deprecated
        @InternalApi
        public void merge​(Report r)
        Deprecated.
        Internal API
        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
      • hasMetrics

        @Deprecated
        public boolean hasMetrics()
        Deprecated.
        Check whether any metrics have been reported
        Returns:
        true if there are metrics, false otherwise
      • hasErrors

        @Deprecated
        public boolean hasErrors()
        Deprecated.
        Use getProcessingErrors().isEmpty()
        Checks whether any processing errors have been reported.
        Returns:
        true if there were any processing errors, false otherwise
      • hasConfigErrors

        @Deprecated
        public boolean hasConfigErrors()
        Deprecated.
        Checks whether any configuration errors have been reported.
        Returns:
        true if there were any configuration errors, false otherwise
      • treeIsEmpty

        @Deprecated
        public boolean treeIsEmpty()
        Deprecated.
        The ReportTree is deprecated, use getViolations().isEmpty() instead.
        Checks whether no violations have been reported.
        Returns:
        true if no violations have been reported, false otherwise
      • 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.
      • treeSize

        @Deprecated
        public int treeSize()
        Deprecated.
        The ReportTree is deprecated
        The number of violations.
        Returns:
        number of violations.
      • getElapsedTimeInMillis

        @Deprecated
        public long getElapsedTimeInMillis()
        Deprecated.
        Unused
      • filterViolations

        @Experimental
        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
      • union

        @Experimental
        public Report union​(Report other)
        Creates a new report by combining this report with another report. This is similar to merge(Report), but instead a new report is created. The lowest start time and greatest end time are kept in the copy.
        Parameters:
        other - the other report to combine
        Returns: