Sha256: fb97d5ae46cd115e2cf9025686c9995f2766618ca593a3dc4275fdb1fa2dab1b

Contents?: true

Size: 888 Bytes

Versions: 12

Compression:

Stored size: 888 Bytes

Contents

class FlogAnalyzer
  include ScoringStrategies

  COLUMNS = %w{score}

  def columns
    COLUMNS
  end

  def name
    :flog
  end

  def map(row)
    row.score
  end

  def reduce(scores)
    ScoringStrategies.average(scores)
  end

  def score(metric_ranking, item)
    ScoringStrategies.identity(metric_ranking, item)
  end

  def generate_records(data, table)
    return if data==nil
    Array(data[:method_containers]).each do |method_container|
      Array(method_container[:methods]).each do |entry|
        file_path = entry[1][:path].sub(%r{^/},'') if entry[1][:path]
        location = MetricFu::Location.for(entry.first)
        table << {
          "metric" => name,
          "score" => entry[1][:score],
          "file_path" => file_path,
          "class_name" => location.class_name,
          "method_name" => location.method_name
        }
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
metric_fu-2.1.3.4 lib/metrics/flog/flog_analyzer.rb
bf4-metric_fu-2.1.3.4 lib/base/flog_analyzer.rb
bf4-metric_fu-2.1.3.3 lib/base/flog_analyzer.rb
bf4-metric_fu-2.1.3.2 lib/base/flog_analyzer.rb
bf4-metric_fu-2.1.3.1 lib/base/flog_analyzer.rb
danmayer-metric_fu-2.1.3 lib/base/flog_analyzer.rb
danmayer-metric_fu-2.1.2 lib/base/flog_analyzer.rb
rferraz-metric_fu-2.1.2 lib/base/flog_analyzer.rb
rferraz-metric_fu-2.1.1 lib/base/flog_analyzer.rb
metric_fu-2.1.1 lib/base/flog_analyzer.rb
metric_fu-2.1.0 lib/base/flog_analyzer.rb
metric_fu-2.0.1 lib/base/flog_analyzer.rb