Sha256: ac61092beef38bb8c51b9df88dac91afb05308dc98da5d0cb084a94f913634d4

Contents?: true

Size: 876 Bytes

Versions: 23

Compression:

Stored size: 876 Bytes

Contents

module CC
  module CLI
    class Config
      delegate :to_yaml, to: :config
      def initialize
        @config = {
          "engines" => {},
          "ratings" => { "paths" => [] },
        }
      end

      def add_engine(engine_name, engine_config)
        config["engines"][engine_name] = { "enabled" => true }

        if engine_config["default_config"].present?
          config["engines"][engine_name]["config"] = engine_config["default_config"]
        end

        config["ratings"]["paths"] |= engine_config["default_ratings_paths"]
      end

      def add_exclude_paths(paths)
        config["exclude_paths"] ||= []
        config["exclude_paths"] += paths.map do |path|
          if path.ends_with?("/")
            "#{path}**/*"
          else
            path
          end
        end
      end

      private

      attr_reader :config
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
codeclimate-0.17.0 lib/cc/cli/config.rb
codeclimate-0.16.6 lib/cc/cli/config.rb
codeclimate-0.16.5 lib/cc/cli/config.rb
codeclimate-0.16.4 lib/cc/cli/config.rb
codeclimate-0.16.3 lib/cc/cli/config.rb
codeclimate-0.16.2 lib/cc/cli/config.rb
codeclimate-0.16.1 lib/cc/cli/config.rb
codeclimate-0.16.0 lib/cc/cli/config.rb
codeclimate-0.15.2 lib/cc/cli/config.rb
codeclimate-0.15.1 lib/cc/cli/config.rb
codeclimate-0.15.0 lib/cc/cli/config.rb
codeclimate-0.14.7 lib/cc/cli/config.rb
codeclimate-0.14.6 lib/cc/cli/config.rb
codeclimate-0.14.5 lib/cc/cli/config.rb
codeclimate-0.14.4 lib/cc/cli/config.rb
codeclimate-0.14.3 lib/cc/cli/config.rb
codeclimate-0.14.2 lib/cc/cli/config.rb
codeclimate-0.14.1 lib/cc/cli/config.rb
codeclimate-0.14.0 lib/cc/cli/config.rb
codeclimate-0.13.0 lib/cc/cli/config.rb