Class: PmdViolation
- Inherits:
-
Object
- Object
- PmdViolation
- Defined in:
- lib/pmd/entity/pmd_violation.rb
Overview
Represent a PMD violation.
Constant Summary collapse
- PRIORITY_ERROR_THRESHOLD =
4
Instance Attribute Summary collapse
-
#violation ⇒ Object
Returns the value of attribute violation.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(violation) ⇒ PmdViolation
constructor
A new instance of PmdViolation.
- #line ⇒ Object
- #priority ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(violation) ⇒ PmdViolation
Returns a new instance of PmdViolation.
8 9 10 |
# File 'lib/pmd/entity/pmd_violation.rb', line 8 def initialize(violation) @violation = violation end |
Instance Attribute Details
#violation ⇒ Object
Returns the value of attribute violation.
6 7 8 |
# File 'lib/pmd/entity/pmd_violation.rb', line 6 def violation @violation end |
Instance Method Details
#description ⇒ Object
24 25 26 |
# File 'lib/pmd/entity/pmd_violation.rb', line 24 def description @description ||= violation.text.gsub("\n", '') end |
#line ⇒ Object
20 21 22 |
# File 'lib/pmd/entity/pmd_violation.rb', line 20 def line @line ||= violation.attribute('beginline').value.to_i end |
#priority ⇒ Object
12 13 14 |
# File 'lib/pmd/entity/pmd_violation.rb', line 12 def priority @priority ||= violation.attribute('priority').value.to_i end |
#type ⇒ Object
16 17 18 |
# File 'lib/pmd/entity/pmd_violation.rb', line 16 def type @type ||= priority < PRIORITY_ERROR_THRESHOLD ? :warn : :fail end |