Class: PmdTester::PmdConfigError
- Inherits:
-
Object
- Object
- PmdTester::PmdConfigError
- Defined in:
- lib/pmdtester/pmd_configerror.rb
Overview
This class represents a ‘configerror’ element of Pmd xml report and which Pmd branch the ‘configerror’ is from
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
The schema of ‘configerror’ node: <xs:complexType name=“configerror”> <xs:attribute name=“rule” type=“xs:string” use=“required” /> <xs:attribute name=“msg” type=“xs:string” use=“required” /> </xs:complexType>.
-
#branch ⇒ Object
readonly
The pmd branch type, ‘base’ or ‘patch’.
-
#old_error ⇒ Object
Returns the value of attribute old_error.
Instance Method Summary collapse
- #changed? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(attrs, branch) ⇒ PmdConfigError
constructor
A new instance of PmdConfigError.
- #msg ⇒ Object
- #rulename ⇒ Object
- #sort_key ⇒ Object
- #try_merge?(other) ⇒ Boolean
Constructor Details
#initialize(attrs, branch) ⇒ PmdConfigError
Returns a new instance of PmdConfigError.
18 19 20 21 22 23 |
# File 'lib/pmdtester/pmd_configerror.rb', line 18 def initialize(attrs, branch) @attrs = attrs @changed = false @branch = branch end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
The schema of ‘configerror’ node: <xs:complexType name=“configerror”>
<xs:attribute name="rule" type="xs:string" use="required" />
<xs:attribute name="msg" type="xs:string" use="required" />
</xs:complexType>
15 16 17 |
# File 'lib/pmdtester/pmd_configerror.rb', line 15 def attrs @attrs end |
#branch ⇒ Object (readonly)
The pmd branch type, ‘base’ or ‘patch’
8 9 10 |
# File 'lib/pmdtester/pmd_configerror.rb', line 8 def branch @branch end |
#old_error ⇒ Object
Returns the value of attribute old_error.
16 17 18 |
# File 'lib/pmdtester/pmd_configerror.rb', line 16 def old_error @old_error end |
Instance Method Details
#changed? ⇒ Boolean
37 38 39 |
# File 'lib/pmdtester/pmd_configerror.rb', line 37 def changed? @changed end |
#eql?(other) ⇒ Boolean
41 42 43 |
# File 'lib/pmdtester/pmd_configerror.rb', line 41 def eql?(other) rulename.eql?(other.rulename) && msg.eql?(other.msg) end |
#hash ⇒ Object
58 59 60 |
# File 'lib/pmdtester/pmd_configerror.rb', line 58 def hash [rulename, msg].hash end |
#msg ⇒ Object
29 30 31 |
# File 'lib/pmdtester/pmd_configerror.rb', line 29 def msg @attrs['msg'] end |
#rulename ⇒ Object
25 26 27 |
# File 'lib/pmdtester/pmd_configerror.rb', line 25 def rulename @attrs['rule'] end |
#sort_key ⇒ Object
33 34 35 |
# File 'lib/pmdtester/pmd_configerror.rb', line 33 def sort_key rulename end |
#try_merge?(other) ⇒ Boolean
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/pmdtester/pmd_configerror.rb', line 45 def try_merge?(other) if branch != BASE && branch != other.branch && rulename == other.rulename && !changed? # not already changed @changed = true @old_error = other true end false end |