class FlayAnalyzer
Constants
- COLUMNS
Public Instance Methods
columns()
click to toggle source
# File lib/base/flay_analyzer.rb, line 6 def columns COLUMNS end
generate_records(data, table)
click to toggle source
# File lib/base/flay_analyzer.rb, line 26 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" => self.name, "file_path" => file, "flay_reason" => problems+" files: #{locations.join(', ')}", "flay_matching_reason" => matching_reason } end end end
map(row)
click to toggle source
# File lib/base/flay_analyzer.rb, line 14 def map(row) ScoringStrategies.present(row) end
name()
click to toggle source
# File lib/base/flay_analyzer.rb, line 10 def name :flay end
reduce(scores)
click to toggle source
# File lib/base/flay_analyzer.rb, line 18 def reduce(scores) ScoringStrategies.sum(scores) end
score(metric_ranking, item)
click to toggle source
# File lib/base/flay_analyzer.rb, line 22 def score(metric_ranking, item) ScoringStrategies.percentile(metric_ranking, item) end