Sha256: 9965ab2b011c5d05763c497dd27166bfaaab68989408fcd3757568b180bc9c9d
Contents?: true
Size: 903 Bytes
Versions: 11
Compression:
Stored size: 903 Bytes
Contents
module MetricFu class FlayGenerator < Generator def self.metric :flay end def emit minimum_score_parameter = options[:minimum_score] ? "--mass #{options[:minimum_score]} " : "" args = "#{minimum_score_parameter} #{options[:dirs_to_flay].join(" ")}" @output = run!(args) end def analyze @matches = @output.chomp.split("\n\n").map{|m| m.split("\n ") } end def to_h target = [] total_score = @matches.shift.first.split('=').last.strip @matches.each do |problem| reason = problem.shift.strip lines_info = problem.map do |full_line| name, line = full_line.split(":") {:name => name.strip, :line => line.strip} end target << [:reason => reason, :matches => lines_info] end {:flay => {:total_score => total_score, :matches => target.flatten}} end end end
Version data entries
11 entries across 11 versions & 1 rubygems