Sha256: 14f1119d3c64ead50450ef9fa42e07eafa963101a66068cbee704fa9075763bc

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

class RcovHotspot < MetricFu::Hotspot
  include MetricFu::HotspotScoringStrategies

  COLUMNS = %w{percentage_uncovered}

  def columns
    COLUMNS
  end

  def name
    :rcov
  end

  def map(row)
    row.percentage_uncovered
  end

  def reduce(scores)
    MetricFu::HotspotScoringStrategies.average(scores)
  end

  def score(metric_ranking, item)
    MetricFu::HotspotScoringStrategies.identity(metric_ranking, item)
  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

  # TODO determine if no-op in pre-factored
  # code was intentional
  def present_group_details(group)

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
metric_fu-4.4.0 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.3.1 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.3.0 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.2.1 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.2.0 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.1.3 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.1.2 lib/metric_fu/metrics/rcov/rcov_hotspot.rb
metric_fu-4.1.1 lib/metric_fu/metrics/rcov/rcov_hotspot.rb