Traverses a Sexp abstract syntax tree and fires events whenever it encounters specific node types.
# File lib/reek/core/code_parser.rb, line 130 def count_clause(sexp) if sexp and !sexp.has_type?(:block) @element.count_statements(1) end end
# File lib/reek/core/code_parser.rb, line 20 def process(exp) meth = "process_#{exp[0]}" meth = :process_default unless self.respond_to?(meth) self.send(meth, exp) @element end
# File lib/reek/core/code_parser.rb, line 53 def process_args(exp) end
# File lib/reek/core/code_parser.rb, line 69 def process_attrasgn(exp) process_call(exp) end
# File lib/reek/core/code_parser.rb, line 59 def process_block(exp) @element.count_statements(CodeParser.count_statements(exp)) process_default(exp) end
# File lib/reek/core/code_parser.rb, line 64 def process_call(exp) @element.record_call_to(exp) process_default(exp) end
# File lib/reek/core/code_parser.rb, line 107 def process_case(exp) process_default(exp) @element.count_statements(-1) end
# File lib/reek/core/code_parser.rb, line 41 def process_class(exp) process_module(exp) end
# File lib/reek/core/code_parser.rb, line 27 def process_default(exp) exp.each { |sub| process(sub) if Array === sub } end
# File lib/reek/core/code_parser.rb, line 45 def process_defn(exp) handle_context(MethodContext, exp[0], exp) end
# File lib/reek/core/code_parser.rb, line 49 def process_defs(exp) handle_context(SingletonMethodContext, exp[0], exp) end
# File lib/reek/core/code_parser.rb, line 93 def process_for(exp) count_clause(exp[3]) process_case(exp) end
# File lib/reek/core/code_parser.rb, line 121 def process_iasgn(exp) @element.record_use_of_self process_default(exp) end
# File lib/reek/core/code_parser.rb, line 77 def process_if(exp) count_clause(exp[2]) count_clause(exp[3]) process_default(exp) @element.count_statements(-1) end
# File lib/reek/core/code_parser.rb, line 117 def process_ivar(exp) process_iasgn(exp) end
# File lib/reek/core/code_parser.rb, line 31 def process_module(exp) name = Source::SexpFormatter.format(exp[1]) scope = ModuleContext.new(@element, name, exp) push(scope) do process_default(exp) unless exp.superclass == [:const, :Struct] check_smells(exp[0]) end scope end
# File lib/reek/core/code_parser.rb, line 73 def process_op_asgn1(exp) process_call(exp) end
# File lib/reek/core/code_parser.rb, line 103 def process_resbody(exp) process_when(exp) end
# File lib/reek/core/code_parser.rb, line 98 def process_rescue(exp) count_clause(exp[1]) process_case(exp) end
# File lib/reek/core/code_parser.rb, line 126 def process_self(exp) @element.record_use_of_self end
# File lib/reek/core/code_parser.rb, line 88 def process_until(exp) count_clause(exp[2]) process_case(exp) end
# File lib/reek/core/code_parser.rb, line 112 def process_when(exp) count_clause(exp[2]) process_default(exp) end
Generated with the Darkfish Rdoc Generator 2.