Sha256: 2cacc061162784c52a481e536bebe40511ad51aa1b7ce26be4cf00e718f81318
Contents?: true
Size: 949 Bytes
Versions: 5
Compression:
Stored size: 949 Bytes
Contents
module MetricFu class FlayGenerator < Generator def self.metric :flay end def emit minimum_score_parameter = options[:minimum_score] ? "--mass #{options[:minimum_score]} " : "" command = %Q(mf-flay #{minimum_score_parameter} #{options[: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
5 entries across 5 versions & 1 rubygems