Class: Cane::AbcCheck::RubyAst
- Inherits:
-
Struct
- Object
- Struct
- Cane::AbcCheck::RubyAst
- Defined in:
- lib/cane/abc_check.rb
Overview
Wrapper object around sexps returned from ripper.
Instance Method Summary collapse
-
#initialize(*args) ⇒ RubyAst
constructor
A new instance of RubyAst.
- #violations ⇒ Object
Constructor Details
#initialize(*args) ⇒ RubyAst
Returns a new instance of RubyAst.
66 67 68 69 |
# File 'lib/cane/abc_check.rb', line 66 def initialize(*args) super self.anon_method_add = true end |
Instance Method Details
#violations ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/cane/abc_check.rb', line 71 def violations process_ast(sexps). select {|nesting, complexity| complexity > max_allowed_complexity }. map {|x| { file: file_name, label: x.first, value: x.last, description: "Methods exceeded maximum allowed ABC complexity" }} end |