Sha256: 3a2c0bc3592367471464f85044a968a2bcd2107321fcdf4dc1745f2ed5b465ee

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

class SaikuroHotspot
  include MetricFu::HotspotScoringStrategies

  COLUMNS = %w{lines complexity}

  def columns
    COLUMNS
  end

  def name
    :saikuro
  end

  def map(row)
    row.complexity
  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[:files].each do |file|
      file_name = file[:filename]
      file[:classes].each do |klass|
        location = MetricFu::Location.for(klass[:class_name])
        offending_class = location.class_name
        klass[:methods].each do |match|
          offending_method = MetricFu::Location.for(match[:name]).method_name
          table << {
            "metric" => name,
            "lines" => match[:lines],
            "complexity" => match[:complexity],
            "class_name" => offending_class,
            "method_name" => offending_method,
            "file_path" => file_name,
          }
        end
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
metric_fu-4.1.0 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-4.0.0 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-3.0.1 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-3.0.0 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.4.pre5 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.4.pre4 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.4.pre2 lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.4.pre lib/metric_fu/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.3.7.18.1 lib/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.3.7.19 lib/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.3.6 lib/metrics/saikuro/saikuro_hotspot.rb
metric_fu-2.1.3.5 lib/metrics/saikuro/saikuro_hotspot.rb