Sha256: 77eb56e7fba7f63c688db60755acb6fba0b7984bde5267ca5726fbaff915d241

Contents?: true

Size: 783 Bytes

Versions: 9

Compression:

Stored size: 783 Bytes

Contents

class MetricFu::ChurnHotspot < MetricFu::Hotspot
  COLUMNS = %w{times_changed}

  def columns
    COLUMNS
  end

  def name
    :churn
  end

  def map_strategy
    :present
  end

  def reduce_strategy
    :sum
  end

  def score_strategy
    :calculate_score
  end

  def calculate_score(metric_ranking, item)
    flat_churn_score = 0.50
    metric_ranking.scored?(item) ? flat_churn_score : 0
  end

  def generate_records(data, table)
    return if data == nil
    Array(data[:changes]).each do |change|
      table << {
        "metric" => :churn,
        "times_changed" => change[:times_changed],
        "file_path" => change[:file_path]
      }
    end
  end

  def present_group(group)
    "detected high level of churn (changed #{group[0].times_changed} times)"
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

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