Sha256: 3fab23294187f7854eff41dc4368b5d018edb56fe447cc57698f6a20f9b5699f

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

require 'flog'

module Attractor
  class RubyCalculator < BaseCalculator
    def initialize(file_prefix: '', minimum_churn_count: 3)
      super(file_prefix: file_prefix, file_extension: 'rb', minimum_churn_count: minimum_churn_count)
    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 & 1 rubygems

Version Path
attractor-1.0.2 lib/attractor/calculators/ruby_calculator.rb
attractor-1.0.1 lib/attractor/calculators/ruby_calculator.rb
attractor-1.0.0 lib/attractor/calculators/ruby_calculator.rb