Sha256: 0b42c6b0159993edf4c8388b33de569f3e710b102d606a122457c9a09ccd2da2
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
$:.unshift File.dirname(__FILE__) require 'rubygems' require 'parse_tree' require 'sexp_processor' module Reek class Checker < SexpProcessor def self.parse_tree_for(code) # :nodoc: ParseTree.new.parse_tree_for_string(code) end attr_accessor :description # Creates a new Ruby code checker. Any smells discovered by # +check_source+ or +check_object+ will be stored in +report+. def initialize(report) super() @smells = report @unsupported -= [:cfunc] @default_method = :process_default @require_empty = @warn_on_default = false end def process_default(exp) exp[1..-1].each { |e| process(e) if Array === e} s(exp) end def report(smell) # :nodoc: @smells << smell end # Analyses the given Ruby source +code+ looking for smells. # Any smells found are saved in the +Report+ object that # was passed to this object's constructor. def check_source(code) check_parse_tree(Checker.parse_tree_for(code)) end # Analyses the given Ruby object +obj+ looking for smells. # Any smells found are saved in the +Report+ object that # was passed to this object's constructor. def check_object(obj) check_parse_tree ParseTree.new.parse_tree(obj) end def to_s # :nodoc: description end def check_parse_tree(sexp) # :nodoc: sexp.each { |exp| process(exp) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-0.2.3 | lib/reek/checker.rb |
reek-0.3.0 | lib/reek/checker.rb |