Sha256: 027b34c2fa81aa911066dfa3f5a703abd7803f6b3a7205177203c5de49954525
Contents?: true
Size: 871 Bytes
Versions: 2
Compression:
Stored size: 871 Bytes
Contents
module MetricFu class Reek < Generator REEK_REGEX = /^(\S+) (.*) \((.*)\)$/ def emit files_to_reek = MetricFu.reek[:dirs_to_reek].map{|dir| Dir[File.join(dir, "**/*.rb")] } @output = `reek #{files_to_reek.join(" ")}` end def analyze @matches = @output.chomp.split("\n\n").map{|m| m.split("\n") } @matches = @matches.map do |match| file_path = match.shift.split('--').first file_path = file_path.gsub('"', ' ').strip code_smells = match.map do |smell| match_object = smell.match(REEK_REGEX) {:method => match_object[1].strip, :message => match_object[2].strip, :type => match_object[3].strip} end {:file_path => file_path, :code_smells => code_smells} end end def to_h {:reek => {:matches => @matches}} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jscruggs-metric_fu-1.0.0 | lib/generators/reek.rb |
jscruggs-metric_fu-1.0.1 | lib/generators/reek.rb |