Package net.sourceforge.pmd
Interface RuleViolation
-
- All Known Implementing Classes:
CachedRuleViolation,ParametricRuleViolation
public interface RuleViolationA RuleViolation is created by a Rule when it identifies a violation of the Rule constraints. RuleViolations are simple data holders that are collected into aReport.Since PMD 6.21.0, implementations of this interface are considered internal API and hence deprecated. Clients should exclusively use this interface.
- See Also:
Rule
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLASS_NAMEKey ingetAdditionalInfo()for the name of the class in which the violation was identified.static Comparator<RuleViolation>DEFAULT_COMPARATORA comparator for rule violations.static StringMETHOD_NAMEKey ingetAdditionalInfo()for the name of the method in which the violation was identified.static StringPACKAGE_NAMEKey ingetAdditionalInfo()for the name of the package in which the violation was identified.static StringVARIABLE_NAMEKey ingetAdditionalInfo()for the name of the variable related to the violation.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Map<String,String>getAdditionalInfo()A map of additional key-value pairs known about this violation.default intgetBeginColumn()Get the column number of the begin line in the source file in which this violation was identified.default intgetBeginLine()Get the begin line number in the source file in which this violation was identified.default StringgetClassName()Deprecated.UseCLASS_NAMEStringgetDescription()Get the description of this violation.default intgetEndColumn()Get the column number of the end line in the source file in which this violation was identified.default intgetEndLine()Get the end line number in the source file in which this violation was identified.default FileIdgetFileId()Return the ID of the file where the violation was found.FileLocationgetLocation()Returns the location where the violation should be reported.default StringgetMethodName()Deprecated.UseMETHOD_NAMEdefault StringgetPackageName()Deprecated.UsePACKAGE_NAMERulegetRule()Get the Rule which identified this violation.default StringgetVariableName()Deprecated.UseVARIABLE_NAME
-
-
-
Field Detail
-
DEFAULT_COMPARATOR
static final Comparator<RuleViolation> DEFAULT_COMPARATOR
A comparator for rule violations. This compares all exposed attributes of a violation, filename first. The remaining parameters are compared in an unspecified order.
-
CLASS_NAME
static final String CLASS_NAME
Key ingetAdditionalInfo()for the name of the class in which the violation was identified.- See Also:
- Constant Field Values
-
VARIABLE_NAME
static final String VARIABLE_NAME
Key ingetAdditionalInfo()for the name of the variable related to the violation.- See Also:
- Constant Field Values
-
METHOD_NAME
static final String METHOD_NAME
Key ingetAdditionalInfo()for the name of the method in which the violation was identified.- See Also:
- Constant Field Values
-
PACKAGE_NAME
static final String PACKAGE_NAME
Key ingetAdditionalInfo()for the name of the package in which the violation was identified.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRule
Rule getRule()
Get the Rule which identified this violation.- Returns:
- The identifying Rule.
-
getDescription
String getDescription()
Get the description of this violation.- Returns:
- The description.
-
getLocation
FileLocation getLocation()
Returns the location where the violation should be reported.
-
getFileId
default FileId getFileId()
Return the ID of the file where the violation was found.
-
getBeginLine
default int getBeginLine()
Get the begin line number in the source file in which this violation was identified.- Returns:
- Begin line number.
-
getBeginColumn
default int getBeginColumn()
Get the column number of the begin line in the source file in which this violation was identified.- Returns:
- Begin column number.
-
getEndLine
default int getEndLine()
Get the end line number in the source file in which this violation was identified.- Returns:
- End line number.
-
getEndColumn
default int getEndColumn()
Get the column number of the end line in the source file in which this violation was identified.- Returns:
- End column number.
-
getAdditionalInfo
Map<String,String> getAdditionalInfo()
A map of additional key-value pairs known about this violation. What data is in there is language specific. Common keys supported by several languages are defined as constants on this interface. The map is unmodifiable.
-
getPackageName
@Deprecated default String getPackageName()
Deprecated.UsePACKAGE_NAMEGet the package name of the Class in which this violation was identified.- Returns:
- The package name.
-
getClassName
@Deprecated default String getClassName()
Deprecated.UseCLASS_NAMEGet the name of the Class in which this violation was identified.- Returns:
- The Class name.
-
getMethodName
@Deprecated default String getMethodName()
Deprecated.UseMETHOD_NAMEGet the method name in which this violation was identified.- Returns:
- The method name.
-
getVariableName
@Deprecated default String getVariableName()
Deprecated.UseVARIABLE_NAMEGet the variable name on which this violation was identified.- Returns:
- The variable name.
-
-