Package net.sourceforge.pmd.reporting
Interface RuleViolation
public interface RuleViolation
A RuleViolation is created by a Rule when it identifies a violation of the
Rule constraints. RuleViolations are simple data holders that are collected
into a
Report.
Since PMD 6.21.0, implementations of this interface are considered internal API and hence deprecated. Clients should exclusively use this interface.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey ingetAdditionalInfo()for the name of the class in which the violation was identified.static final Comparator<RuleViolation> A comparator for rule violations.static final StringKey ingetAdditionalInfo()for the name of the method in which the violation was identified.static final StringKey ingetAdditionalInfo()for the name of the package in which the violation was identified.static final StringKey ingetAdditionalInfo()for the name of the variable related to the violation. -
Method Summary
Modifier and TypeMethodDescriptionA map of additional key-value pairs known about this violation.default intGet the column number of the begin line in the source file in which this violation was identified.default intGet the begin line number in the source file in which this violation was identified.Get the description of this violation.default intGet the column number of the end line in the source file in which this violation was identified.default intGet the end line number in the source file in which this violation was identified.default FileIdReturn the ID of the file where the violation was found.Returns the location where the violation should be reported.getRule()Get the Rule which identified this violation.
-
Field Details
-
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
Key ingetAdditionalInfo()for the name of the class in which the violation was identified.- See Also:
-
VARIABLE_NAME
Key ingetAdditionalInfo()for the name of the variable related to the violation.- See Also:
-
METHOD_NAME
Key ingetAdditionalInfo()for the name of the method in which the violation was identified.- See Also:
-
PACKAGE_NAME
Key ingetAdditionalInfo()for the name of the package in which the violation was identified.- See Also:
-
-
Method Details
-
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
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
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.
-