Sha256: c4fef16558539fc3123f9ef477d477cda3df803f65d146b84c4155a0cf83b899

Contents?: true

Size: 995 Bytes

Versions: 9

Compression:

Stored size: 995 Bytes

Contents

class MetricFu::FlogHotspot < MetricFu::Hotspot
  COLUMNS = %w{score}

  def columns
    COLUMNS
  end

  def name
    :flog
  end

  def map_strategy
    :score
  end

  def reduce_strategy
    :average
  end

  def score_strategy
    :identity
  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

  def present_group(group)
    occurences = group.size
    complexity = get_mean(group.column("score"))
    "#{'average ' if occurences > 1}complexity is %.1f" % complexity
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
metric_fu-4.13.0 lib/metric_fu/metrics/flog/hotspot.rb
fastruby-metric_fu-5.0.0 lib/metric_fu/metrics/flog/hotspot.rb
code_metric_fu-4.14.4 lib/metric_fu/metrics/flog/hotspot.rb
code_metric_fu-4.14.3 lib/metric_fu/metrics/flog/hotspot.rb
code_metric_fu-4.14.2 lib/metric_fu/metrics/flog/hotspot.rb
code_metric_fu-4.14.1 lib/metric_fu/metrics/flog/hotspot.rb
code_metric_fu-4.14.0 lib/metric_fu/metrics/flog/hotspot.rb
metric_fu-4.12.0 lib/metric_fu/metrics/flog/hotspot.rb
metric_fu-4.11.4 lib/metric_fu/metrics/flog/hotspot.rb