Interface ViolationSuppressor

  • All Known Implementing Classes:
    AbstractAnnotationSuppressor

    public interface ViolationSuppressor
    An object that suppresses rule violations. Suppressors are used by RuleContext to filter out violations. In PMD 6.0.x, the Report object filtered violations itself - but it has no knowledge of language-specific suppressors.
    • Field Detail

      • REGEX_SUPPRESSOR

        static final ViolationSuppressor REGEX_SUPPRESSOR
        Suppressor for the violationSuppressRegex property.
      • XPATH_SUPPRESSOR

        static final ViolationSuppressor XPATH_SUPPRESSOR
        Suppressor for the violationSuppressXPath property.
    • Method Detail

      • getId

        String getId()
        A name, for reporting and documentation purposes.
      • getUnusedSuppressors

        default Set<ViolationSuppressor.UnusedSuppressorNode> getUnusedSuppressors​(RootNode tree)
        Return the set of suppressor nodes related to this suppressor that were not used during the analysis. For instance, for an annotation suppressor, the set contains suppressor nodes wrapping annotations. This must be implemented if this suppressor wants to play well with the unused PMD suppression rule.
        Parameters:
        tree - Root node of a file
        Returns:
        A set
        Since:
        7.14.0