Sha256: 0e4d5da69d1bf9836be1c93e706df61a6eedd064370325e7eeb4181170099dcd

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 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)
      @type = "JavaScript"
    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

1 entries across 1 versions & 1 rubygems

Version Path
attractor-1.1.0 lib/attractor/calculators/js_calculator.rb