Package org.apache.maven.plugins.pmd
Class ExcludeViolationsFromFile
- java.lang.Object
-
- org.apache.maven.plugins.pmd.ExcludeViolationsFromFile
-
- All Implemented Interfaces:
ExcludeFromFile<Violation>
public class ExcludeViolationsFromFile extends java.lang.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 propertypmd.excludeFromFailureFile.- Author:
- Andreas Dangel
-
-
Constructor Summary
Constructors Constructor Description ExcludeViolationsFromFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountExclusions()Determines how many exclusions are considered.booleanisExcludedFromFailure(net.sourceforge.pmd.RuleViolation errorDetail)Checks whether the givenRuleViolationis excluded.booleanisExcludedFromFailure(Violation errorDetail)Checks whether the given violation is excluded.voidloadExcludeFromFailuresData(java.lang.String excludeFromFailureFile)Loads the exclude definitions from the given file.
-
-
-
Method Detail
-
loadExcludeFromFailuresData
public void loadExcludeFromFailuresData(java.lang.String excludeFromFailureFile) throws MojoExecutionExceptionDescription copied from interface:ExcludeFromFileLoads the exclude definitions from the given file.- Specified by:
loadExcludeFromFailuresDatain interfaceExcludeFromFile<Violation>- Parameters:
excludeFromFailureFile- the path to the properties file- Throws:
MojoExecutionException- if the properties file couldn't be loaded
-
isExcludedFromFailure
public boolean isExcludedFromFailure(Violation errorDetail)
Description copied from interface:ExcludeFromFileChecks whether the given violation is excluded. Note: the exclusions must have been loaded before viaExcludeFromFile.loadExcludeFromFailuresData(String).- Specified by:
isExcludedFromFailurein interfaceExcludeFromFile<Violation>- Parameters:
errorDetail- the violation to check- Returns:
trueif the violation should be excluded,falseotherwise.
-
isExcludedFromFailure
public boolean isExcludedFromFailure(net.sourceforge.pmd.RuleViolation errorDetail)
Checks whether the givenRuleViolationis excluded. Note: the exclusions must have been loaded before vialoadExcludeFromFailuresData(String).- Parameters:
errorDetail- the violation to check- Returns:
trueif the violation should be excluded,falseotherwise.
-
countExclusions
public int countExclusions()
Description copied from interface:ExcludeFromFileDetermines how many exclusions are considered.- Specified by:
countExclusionsin interfaceExcludeFromFile<Violation>- Returns:
- the number of active exclusions
-
-