Sha256: d7f72bd749e54b920975f0cdf15cdbbbf892c91770468b94f5d4e7b7580cebba

Contents?: true

Size: 1.06 KB

Versions: 29

Compression:

Stored size: 1.06 KB

Contents

require 'stringio'

begin
  # Go nuclear on "warning: parser/current ..."
  $stderr = StringIO.new
  require 'rubocop'
ensure
  $stderr = STDERR
end

module NdrDevSupport
  module Rubocop
    # Following approach of rubocop-hq/rubocop-extension-generator,
    # monkey-patch in default configuration.
    module Inject
      def self.defaults!
        root = Pathname.new(__dir__).parent.parent.parent.expand_path
        path = root.join('config', 'rubocop', 'ndr.yml').to_s

        # Whereas by default, the raw YAML would be processed, we pass
        # through the ConfigLoader fully - this ensures `require` and
        # `inherit_from` statements are properly evaluated.
        #
        # PR at rubocop-hq/rubocop-extension-generator/pull/9
        #
        config = ::RuboCop::ConfigLoader.load_file(path)
        puts "configuration from \#{path}" if ::RuboCop::ConfigLoader.debug?

        config = ::RuboCop::ConfigLoader.merge_with_default(config, path)
        ::RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
ndr_dev_support-6.1.0 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-6.0.4 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-6.0.3 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-6.0.2 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-6.0.1 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-6.0.0 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.10.2 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.10.1 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.10.0 lib/ndr_dev_support/rubocop/inject.rb