Sha256: 50a96392d0c4d9c449287c2107d3ad340015bdc37faf89a7b218e0ec00b49f71
Contents?: true
Size: 886 Bytes
Versions: 1
Compression:
Stored size: 886 Bytes
Contents
module Skeptic class Critic attr_accessor :lines_per_method attr_accessor :max_nesting_depth attr_accessor :methods_per_class attr_accessor :no_semicolons attr_reader :criticism def initialize @criticism = [] end def criticize(code) @code = code @tokens = Ripper.lex(code) @sexp = Ripper.sexp(code) rules = { Rules::LinesPerMethod => lines_per_method, Rules::MaxNestingDepth => max_nesting_depth, Rules::MethodsPerClass => methods_per_class, Rules::NoSemicolons => no_semicolons, } rules.reject { |rule_type, option| option.nil? }.each do |rule_type, option| rule = rule_type.new(option) rule.apply_to @tokens, @sexp rule.violations.each do |violation| @criticism << [violation, rule.name] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
skeptic-0.0.0 | lib/skeptic/critic.rb |