Sha256: bcc9265e22e8bb31519293a72dec77952821a98d03bc792af120c9fb7af1f374

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

MetricFu.reporting_require { 'graphs/grapher' }
module MetricFu
  class ReekGrapher < Grapher
    attr_accessor :reek_count, :labels

    def self.metric
      :reek
    end

    def initialize
      super
      @reek_count = {}
      @labels = {}
    end

    def get_metrics(metrics, date)
      if metrics && metrics[:reek]
        counter = @labels.size
        @labels.update( { @labels.size => date })

        metrics[:reek][:matches].each do |reek_chunk|
          reek_chunk[:code_smells].each do |code_smell|
            # speaking of code smell...
            @reek_count[code_smell[:type]] = [] if @reek_count[code_smell[:type]].nil?
            if @reek_count[code_smell[:type]][counter].nil?
              @reek_count[code_smell[:type]][counter] = 1
            else
              @reek_count[code_smell[:type]][counter] += 1
            end
          end
        end
      end
    end

    def title
      'Reek: code smells'
    end

    def data
      @reek_count.map do |name, count|
        [name, count.join(',')]
      end
    end

    def output_filename
      'reek.js'
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
metric_fu-4.8.0 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.7.4 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.7.3 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.7.2 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.7.1 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.7.0 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.6.0 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.5.2 lib/metric_fu/metrics/reek/reek_grapher.rb
metric_fu-4.5.1 lib/metric_fu/metrics/reek/reek_grapher.rb