Class ExcludeDuplicationsFromFile

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

public class ExcludeDuplicationsFromFile extends Object implements ExcludeFromFile<Duplication>
This class contains utility methods to load property files which define which files should be excluded from the CPD duplication results. See property pmd.excludeFromFailureFile.
Author:
Andreas Dangel
  • Constructor Details

    • ExcludeDuplicationsFromFile

      public ExcludeDuplicationsFromFile()
  • Method Details

    • isExcludedFromFailure

      public boolean isExcludedFromFailure(Duplication 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<Duplication>
      Parameters:
      errorDetail - the violation to check
      Returns:
      true if the violation should be excluded, false otherwise.
    • isExcludedFromFailure

      public boolean isExcludedFromFailure(net.sourceforge.pmd.cpd.Match errorDetail)
      Checks whether the given Match is excluded. Note: The exclusion must have been loaded before via loadExcludeFromFailuresData(String).
      Parameters:
      errorDetail - the duplication to check
      Returns:
      true if the given duplication should be excluded, false otherwise.
    • 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<Duplication>
      Parameters:
      excludeFromFailureFile - the path to the properties file
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if the properties file couldn't be loaded
    • countExclusions

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