Sha256: 3be9c077f3e9fa21f9ef98be0a01001bd9d9c7678ce3a5d5f04bb8e5095785dc

Contents?: true

Size: 953 Bytes

Versions: 8

Compression:

Stored size: 953 Bytes

Contents

require 'rubocop'

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

8 entries across 8 versions & 1 rubygems

Version Path
ndr_dev_support-5.9.0 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.8.2 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.8.1 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.8.0 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.7.1 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.7.0 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.6.0 lib/ndr_dev_support/rubocop/inject.rb
ndr_dev_support-5.5.0 lib/ndr_dev_support/rubocop/inject.rb