Class ExcludeViolationsFromFile

java.lang.Object
org.apache.maven.plugins.pmd.ExcludeViolationsFromFile
All Implemented Interfaces:
ExcludeFromFile<Violation>

public class ExcludeViolationsFromFile extends Object implements ExcludeFromFile<Violation>
This class contains utility for loading property files, which define which PMD violations from which classes should be ignored and not cause a failure. See property pmd.excludeFromFailureFile.
Author:
Andreas Dangel
  • Constructor Details

    • ExcludeViolationsFromFile

      public ExcludeViolationsFromFile()
  • Method Details

    • loadExcludeFromFailuresData

      public void loadExcludeFromFailuresData(String excludeFromFailureFile) throws org.apache.maven.plugin.MojoExecutionException
      Description copied from interface: ExcludeFromFile
      Loads the exclude definitions from the given file.
      Specified by:
      loadExcludeFromFailuresData in interface ExcludeFromFile<Violation>
      Parameters:
      excludeFromFailureFile - the path to the properties file
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if the properties file couldn't be loaded
    • isExcludedFromFailure

      public boolean isExcludedFromFailure(Violation errorDetail)
      Description copied from interface: ExcludeFromFile
      Checks whether the given violation is excluded. Note: the exclusions must have been loaded before via ExcludeFromFile.loadExcludeFromFailuresData(String).
      Specified by:
      isExcludedFromFailure in interface ExcludeFromFile<Violation>
      Parameters:
      errorDetail - the violation to check
      Returns:
      true if the violation should be excluded, false otherwise.
    • isExcludedFromFailure

      public boolean isExcludedFromFailure(net.sourceforge.pmd.RuleViolation errorDetail)
      Checks whether the given RuleViolation is excluded. Note: the exclusions must have been loaded before via loadExcludeFromFailuresData(String).
      Parameters:
      errorDetail - the violation to check
      Returns:
      true if the violation should be excluded, false otherwise.
    • countExclusions

      public int countExclusions()
      Description copied from interface: ExcludeFromFile
      Determines how many exclusions are considered.
      Specified by:
      countExclusions in interface ExcludeFromFile<Violation>
      Returns:
      the number of active exclusions