Sha256: 2e2f78115cbb278f468ae35d96e8c32a1226eef22f7472739228b9a172fe80c5

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 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/
        **/*.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

4 entries across 4 versions & 1 rubygems

Version Path
codeclimate-0.70.3 lib/cc/config/default_adapter.rb
codeclimate-0.70.2 lib/cc/config/default_adapter.rb
codeclimate-0.70.1 lib/cc/config/default_adapter.rb
codeclimate-0.70.0 lib/cc/config/default_adapter.rb