Sha256: 76fb3794edef76b35d70e6a90443ace335d5dc587ef40853cd125ae57da241f5

Contents?: true

Size: 1.06 KB

Versions: 106

Compression:

Stored size: 1.06 KB

Contents

module Standard
  module Plugin
    class StandardizesConfiguredPlugins
      DEFAULT_PLUGIN_CONFIG = {
        "enabled" => true,
        "require_path" => nil, # If not set, will be set to the plugin name
        "plugin_class_name" => nil # If not set, looks for gemspec `spec.metadata["default_lint_roller_plugin"]`
      }.freeze

      BUILT_INS = [
        {"standard-base" => {
          "require_path" => "standard/base",
          "plugin_class_name" => "Standard::Base::Plugin"
        }},
        "standard-custom",
        "standard-performance"
      ].freeze

      def call(plugins)
        normalize_config_shape(BUILT_INS + plugins)
      end

      private

      def normalize_config_shape(plugins)
        plugins.map { |plugin|
          if plugin.is_a?(Hash)
            plugin_name = plugin.keys.first
            [plugin_name, DEFAULT_PLUGIN_CONFIG.merge({"require_path" => plugin_name}, plugin.values.first)]
          else
            [plugin, DEFAULT_PLUGIN_CONFIG.merge("require_path" => plugin)]
          end
        }.to_h
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 3 rubygems

Version Path
harbr-0.1.88 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.87 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.86 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.85 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.84 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.83 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.82 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.81 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.80 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.79 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.78 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.77 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.76 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.75 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.74 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.73 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.72 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.71 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.70 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb
harbr-0.1.69 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/plugin/standardizes_configured_plugins.rb