Sha256: 580b8c6091ed71a5a76244a4cb2de44163d8e93b2f1957301d7dd91fcdb970a7

Contents?: true

Size: 492 Bytes

Versions: 3

Compression:

Stored size: 492 Bytes

Contents

# frozen_string_literal: true

module Attractor
  class JsCalculator < BaseCalculator
    def initialize(file_prefix: '', minimum_churn_count: 3)
      super(file_prefix: file_prefix, file_extension: '(js|jsx)', minimum_churn_count: minimum_churn_count)
    end

    def calculate
      super do |change|
        complexity, details = JSON.parse(`node #{__dir__}/../../../dist/calculator.bundle.js #{Dir.pwd}/#{change[:file_path]}`)

        [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/js_calculator.rb
attractor-1.0.1 lib/attractor/calculators/js_calculator.rb
attractor-1.0.0 lib/attractor/calculators/js_calculator.rb