Skip to content

Commit

Permalink
Fix rakefile to validate RuboCop 1.0+ rules
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Nov 5, 2020
1 parent 32091d9 commit f657c2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ task :vendor do
require "rubocop"
require "yaml" unless defined?(YAML)
cfg = RuboCop::Cop::Cop.all.each_with_object({}) { |cop, acc| acc[cop.cop_name] = { "Enabled" => false } unless cop.cop_name.start_with?("Chef") }
File.open(dst.join("disable_all.yml"), "w") { |fh| fh.write cfg.to_yaml }
File.open(dst.join("disable_all.yml"), "w") { |fh| fh.write YAML.dump(cfg) }

sh %{git add #{dst}/{upstream,disable_all}.yml}
sh %{git commit -m "Vendor rubocop-#{upstream.version} upstream configuration."}
Expand Down Expand Up @@ -48,8 +48,8 @@ task :validate_config do

RuboCop::Cop::Chef.constants.each do |dep|
RuboCop::Cop::Chef.const_get(dep).constants.each do |cop|
unless config["#{dep}/#{cop}"]
puts "Error: #{dep}/#{cop} not found in config/chefstyle.yml"
unless config["Chef/#{dep}/#{cop}"]
puts "Error: Chef/#{dep}/#{cop} not found in config/chefstyle.yml"
status = 1
end
end
Expand Down

0 comments on commit f657c2a

Please sign in to comment.