Sha256: 2e051981a387406f23aa34f596b979f0762566f10b8ea0586e27f9984f995c64

Contents?: true

Size: 1.01 KB

Versions: 109

Compression:

Stored size: 1.01 KB

Contents

require_relative "../file_finder"
require_relative "../plugin"

class Standard::CreatesConfigStore
  class MergesUserConfigExtensions
    class ExtendConfigPlugin < LintRoller::Plugin
      def initialize(path)
        @yaml_path = Standard::FileFinder.new.call(path, Dir.pwd)
      end

      def about
        About.new("Pseudo-plugin wrapping the `extend_config' path: #{@yaml_path}")
      end

      def rules(context)
        LintRoller::Rules.new(
          type: :path,
          config_format: :rubocop,
          value: @yaml_path
        )
      end
    end

    def initialize
      @merges_plugins_into_rubocop_config = Standard::Plugin::MergesPluginsIntoRubocopConfig.new
    end

    def call(options_config, standard_config)
      return unless standard_config[:extend_config]&.any?

      plugins = standard_config[:extend_config].map { |path|
        ExtendConfigPlugin.new(path)
      }
      @merges_plugins_into_rubocop_config.call(options_config, standard_config, plugins, permit_merging: false)
    end
  end
end

Version data entries

109 entries across 109 versions & 3 rubygems

Version Path
standard-1.47.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.46.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.45.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.44.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.43.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.42.1 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.42.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.41.1 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.41.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.40.1 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.40.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.39.2 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.39.1 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.39.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.38.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.37.0 lib/standard/creates_config_store/merges_user_config_extensions.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/standard-1.32.0/lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.35.0.1 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.34.0.1 lib/standard/creates_config_store/merges_user_config_extensions.rb
standard-1.35.1 lib/standard/creates_config_store/merges_user_config_extensions.rb