Class: Tuxedo::CaneViolation::AbcMaxViolation
- Inherits:
-
Tuxedo::CaneViolation
- Object
- Tuxedo::CaneViolation
- Tuxedo::CaneViolation::AbcMaxViolation
- Defined in:
- lib/tuxedo/cane_violation/abc_max_violation.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#complexity ⇒ Object
Returns the value of attribute complexity.
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#expression ⇒ Object
Returns the value of attribute expression.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Tuxedo::CaneViolation
#violation_type, #violation_type_snake_cased
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
5 6 7 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 5 def class_name @class_name end |
#complexity ⇒ Object
Returns the value of attribute complexity.
4 5 6 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 4 def complexity @complexity end |
#detail ⇒ Object
Returns the value of attribute detail.
4 5 6 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 4 def detail @detail end |
#expression ⇒ Object
Returns the value of attribute expression.
5 6 7 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 5 def expression @expression end |
#file_name ⇒ Object
Returns the value of attribute file_name.
4 5 6 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 4 def file_name @file_name end |
#method_name ⇒ Object
Returns the value of attribute method_name.
5 6 7 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 5 def method_name @method_name end |
Class Method Details
.from_cane(cane_violation) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 7 def self.from_cane(cane_violation) violation = new violation.file_name = cane_violation.file_name violation.detail = cane_violation.detail violation.complexity = cane_violation.complexity parts = violation.detail.split(" > ") violation.class_name = parts[-2] violation.method_name = parts[-1] violation.expression = parts[0..-2].join("::") + "." + parts[-1] violation end |
Instance Method Details
#description ⇒ Object
22 23 24 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 22 def description "Methods exceeded maximum allowed ABC complexity" end |
#to_hash ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/tuxedo/cane_violation/abc_max_violation.rb', line 26 def to_hash { :violation_type => violation_type, :file_name => file_name, :detail => detail, :complexity => complexity, :description => description, } end |