Sha256: 1c0b4d65948be70666270ec6ec50e0c16229ba1a4e0424efb4e06d4d94ae9974
Contents?: true
Size: 917 Bytes
Versions: 7
Compression:
Stored size: 917 Bytes
Contents
module MetricFu class Flay < Generator def emit minimum_score_parameter = MetricFu.flay[:minimum_score] ? "--mass #{MetricFu.flay[:minimum_score]} " : "" command = %Q(mf-flay #{minimum_score_parameter} #{MetricFu.flay[:dirs_to_flay].join(" ")}) mf_debug "** #{command}" @output = `#{command}` 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
7 entries across 7 versions & 1 rubygems