Sha256: d26479ba73f16ac5c28f7ad4fca36cdff4154178119f77df651b5a9bf16a0fbc

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 Bytes

Contents

# frozen_string_literal: true

require 'flog'

module Attractor
  class RubyCalculator < BaseCalculator
    def initialize(file_prefix: '', minimum_churn_count: 3, start_ago: 365 * 5)
      super(file_prefix: file_prefix, file_extension: 'rb', minimum_churn_count: minimum_churn_count, start_ago: start_ago)
      @type = "Ruby"
    end

    def calculate
      super do |change|
        flogger = Flog.new(all: true)
        flogger.flog(change[:file_path])
        complexity = flogger.total_score
        details = flogger.totals
        [complexity, details]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
attractor-ruby-0.1.0 lib/attractor/calculators/ruby_calculator.rb
attractor-1.2.0 lib/attractor/calculators/ruby_calculator.rb
attractor-1.1.1 lib/attractor/calculators/ruby_calculator.rb