Sha256: ffd05462d7ba1fc8de5d64a969772ab0025fc623c3149271f4ca2ea2266b9e54

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

class MetricFu::RcovHotspot < MetricFu::Hotspot
  COLUMNS = %w{percentage_uncovered}

  def columns
    COLUMNS
  end

  def name
    :rcov
  end

  def map_strategy
    :percentage_uncovered
  end

  def reduce_strategy
    :average
  end

  def score_strategy
    :identity
  end

  def generate_records(data, table)
    return if data == nil
    data.each do |file_name, info|
      next if (file_name == :global_percent_run) || (info[:methods].nil?)
      info[:methods].each do |method_name, percentage_uncovered|
        location = MetricFu::Location.for(method_name)
        table << {
          "metric" => :rcov,
          "file_path" => file_name,
          "class_name" => location.class_name,
          "method_name" => location.method_name,
          "percentage_uncovered" => percentage_uncovered
        }
      end
    end
  end

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

Version data entries

9 entries across 9 versions & 3 rubygems

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