Sha256: 551cec1ee11d5bdd19c2491338b10e4a9b0504038096331e97c9da9b49015f81
Contents?: true
Size: 1.1 KB
Versions: 9
Compression:
Stored size: 1.1 KB
Contents
class MetricFu::FlayHotspot < MetricFu::Hotspot COLUMNS = %w{flay_reason flay_matching_reason} def columns COLUMNS end def name :flay end def map_strategy :present end def reduce_strategy :sum end def score_strategy :percentile end def generate_records(data, table) return if data == nil Array(data[:matches]).each do |match| problems = match[:reason] matching_reason = problems.gsub(/^[0-9]+\) /, "").gsub(/\:[0-9]+/, "") files = [] locations = [] match[:matches].each do |file_match| file_path = file_match[:name].sub(%r{^/}, "") locations << "#{file_path}:#{file_match[:line]}" files << file_path end files = files.uniq files.each do |file| table << { "metric" => name, "file_path" => file, "flay_reason" => problems + " files: #{locations.join(', ')}", "flay_matching_reason" => matching_reason } end end end def present_group(group) occurences = group.size "found #{occurences} code duplications" end end
Version data entries
9 entries across 9 versions & 3 rubygems