Sha256: daced9b7bd5fcdd1b2f04a07be3853f80f05ea699339abf55422bbd6da1836ac
Contents?: true
Size: 933 Bytes
Versions: 3
Compression:
Stored size: 933 Bytes
Contents
require 'flay' module MetricFu class Flay < Generator def emit mimimum_score_parameter = MetricFu.flay[:minimum_score] ? "--mass #{MetricFu.flay[:minimum_score]} " : "" command = %Q(mf-flay #{mimimum_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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
metric_fu-3.0.0 | lib/metric_fu/metrics/flay/flay.rb |
metric_fu-2.1.4.pre5 | lib/metric_fu/metrics/flay/flay.rb |
metric_fu-2.1.4.pre4 | lib/metric_fu/metrics/flay/flay.rb |