Sha256: 481ba91ca4a104d6616eb3afc9cffed9b60cc07c18dc9015d1702c38d971954f

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module CC
  class Config
    class DefaultAdapter
      # intentionally not sorted: we want them in a particular order
      ENGINES = {
        "structure".freeze => "stable".freeze,
        "duplication".freeze => "cronopio".freeze,
      }.freeze

      EXCLUDE_PATTERNS = %w[
        config/
        db/
        dist/
        features/
        **/node_modules/
        script/
        **/spec/
        **/test/
        **/tests/
        **/vendor/
        **/*_test.go
        **/*.d.ts
      ].freeze

      attr_reader :config

      def initialize(data = {})
        @config = data

        apply_default_excludes
        apply_default_engines
      end

      private

      def apply_default_engines
        config["plugins"] ||= {}

        ENGINES.each do |name, channel|
          config["plugins"][name] ||= {}
          unless [true, false].include?(config["plugins"][name]["enabled"])
            config["plugins"][name]["enabled"] = true
          end
          config["plugins"][name]["channel"] ||= channel
        end
      end

      def apply_default_excludes
        config["exclude_patterns"] ||= EXCLUDE_PATTERNS
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codeclimate-0.70.5 lib/cc/config/default_adapter.rb
codeclimate-0.70.4 lib/cc/config/default_adapter.rb