Sha256: e4503f8518f3f28cfab2932df3719d75cd1988804dbf4c51b55a8cf7254b2c24
Contents?: true
Size: 868 Bytes
Versions: 16
Compression:
Stored size: 868 Bytes
Contents
require 'flay' module MetricFu class Flay < Generator def emit mimimum_score_parameter = MetricFu.flay[:minimum_score] ? "--mass #{MetricFu.flay[:minimum_score]} " : "" @output = `flay #{mimimum_score_parameter} #{MetricFu.flay[:dirs_to_flay].join(" ")}` 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
16 entries across 16 versions & 4 rubygems