Skip to content

Commit 22087e2

Browse files
committed
Add a spec for config/default.yml
Follow up rubocop/rubocop#11913.
1 parent ee3554b commit 22087e2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/project_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@
103103
end
104104
end
105105

106+
it 'does not include unnecessary `SafeAutoCorrect: false`' do
107+
cop_names.each do |cop_name|
108+
next unless config.dig(cop_name, 'Safe') == false
109+
110+
safe_autocorrect = config.dig(cop_name, 'SafeAutoCorrect')
111+
112+
expect(safe_autocorrect).not_to(be(false), "`#{cop_name}` has unnecessary `SafeAutoCorrect: false` config.")
113+
end
114+
end
115+
106116
it 'is expected that all cops documented with `@safety` are `Safe: false` or `SafeAutoCorrect: false`' do
107117
require 'yard'
108118

0 commit comments

Comments
 (0)