lib/cookstyle.rb in cookstyle-7.32.2 vs lib/cookstyle.rb in cookstyle-7.32.7

- old
+ new

@@ -13,30 +13,17 @@ require_relative 'rubocop/monkey_patches/config' require_relative 'rubocop/monkey_patches/base' require_relative 'rubocop/monkey_patches/team' require_relative 'rubocop/monkey_patches/registry_cop' -module RuboCop - class ConfigLoader - RUBOCOP_HOME.gsub!( - /^.*$/, - File.realpath(File.join(__dir__, '..')) - ) - - DEFAULT_FILE.gsub!( - /^.*$/, - File.join(RUBOCOP_HOME, 'config', 'default.yml') - ) - end -end - # Cookstyle patches the RuboCop tool to set a new default configuration that # is vendored in the Cookstyle codebase. module Cookstyle # @return [String] the absolute path to the main RuboCop configuration YAML file def self.config - RuboCop::ConfigLoader::DEFAULT_FILE + config_file = const_defined?('CHEFSTYLE_CONFIG') ? 'chefstyle.yml' : 'default.yml' + File.realpath(File.join(__dir__, '..', 'config', config_file)) end end require_relative 'rubocop/chef' require_relative 'rubocop/chef/autocorrect_helpers' @@ -49,5 +36,10 @@ Dir.glob(__dir__ + '/rubocop/cop/**/*.rb') do |file| next if File.directory?(file) require_relative file # not actually relative but require_relative is faster end + +# stub default value of TargetChefVersion to avoid STDERR noise +RuboCop::ConfigLoader.default_configuration['AllCops']['TargetChefVersion'] = '~' + +RuboCop::ConfigLoader.default_configuration = RuboCop::ConfigLoader.configuration_from_file(Cookstyle.config)