Sha256: 20dcf8247c61ea9ce5da048398317cb69dec71d3d8309ae110bf46a4634c0f35
Contents?: true
Size: 991 Bytes
Versions: 4
Compression:
Stored size: 991 Bytes
Contents
module MetricFu class Flay < Generator def self.verify_dependencies! `flay --help` raise 'sudo gem install flay # if you want the flay tasks' unless $?.success? end def emit files_to_flay = MetricFu.flay[:dirs_to_flay].map{|dir| Dir[File.join(dir, "**/*.rb")] } files = remove_excluded_files(files_to_flay.flatten) @output = `flay #{files.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
4 entries across 4 versions & 3 rubygems
Version | Path |
---|---|
edouard-metric_fu-1.2.0 | lib/generators/flay.rb |
metric_fu-1.2.0 | lib/generators/flay.rb |
flyerhzm-metric_fu-1.0.0 | lib/generators/flay.rb |
metric_fu-1.1.6 | lib/generators/flay.rb |