Sha256: f2bd09851c88edebd101c460246acf8185b8870087cf391e256578bcc59cd349

Contents?: true

Size: 836 Bytes

Versions: 97

Compression:

Stored size: 836 Bytes

Contents

module CC
  class Config
    class ChecksAdapter
      attr_reader :config

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

        return unless checks.present?
        copy_qm_checks_config
      end

      private

      def copy_qm_checks_config
        DefaultAdapter::ENGINES.keys.each do |name|
          copy_checks(name)
        end
      end

      def copy_checks(engine_name)
        engine = config.fetch("plugins", {}).fetch(engine_name, {})
        engine["config"] ||= {}

        if engine["config"].is_a?(String)
          engine["config"] = {
            "file" => engine["config"],
            "checks" => checks,
          }
        elsif engine["config"].is_a?(Hash)
          engine["config"]["checks"] = checks
        end
      end

      def checks
        config["checks"]
      end
    end
  end
end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
codeclimate-0.85.27 lib/cc/config/checks_adapter.rb
codeclimate-0.85.26 lib/cc/config/checks_adapter.rb
codeclimate-0.85.25 lib/cc/config/checks_adapter.rb
codeclimate-0.85.24 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.54 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.53 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.52 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.51 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.50 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.49 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.48 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.47 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.46 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.45 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.44 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.43 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.42 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.41 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.40 lib/cc/config/checks_adapter.rb
codeclimate-fede-0.85.39 lib/cc/config/checks_adapter.rb