Skip to content

Commit 89f9a05

Browse files
committed
Patch RuboCop::Config to warn on obsolete cops
Instead of raising on the inclusion of an obsolete cop, write an error to STDERR. This is slightly more invisible than failing a build on an obsolete cop, but preferable as a user won't be blocked when we bump RuboCop on our engine. We'll write a changelog post advising users of the necessary changes to make and deprecate this patch in the coming weeks.
1 parent 562cea6 commit 89f9a05

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/cc/engine/rubocop.rb

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require "delegate"
33
require "pathname"
44
require "rubocop"
5+
require "rubocop/config_patch"
56
require "rubocop/cop/method_complexity_patch"
67
require "rubocop/cop/method_length"
78
require "rubocop/cop/class_length"

lib/rubocop/config_patch.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
RuboCop::Config.class_eval do
2+
def reject_obsolete_cops
3+
RuboCop::Config::OBSOLETE_COPS.each do |cop_name, message|
4+
next unless key?(cop_name) || key?(cop_name.split('/').last)
5+
message += "\n(obsolete configuration found in #{loaded_path}, please" \
6+
' update it)'
7+
$stderr.puts message
8+
end
9+
end
10+
end

0 commit comments

Comments
 (0)