RuboCop: Fix prefix configuration for RSpec/ContextWording
What does this MR do and why?
In YAML, we must quote some string literals like no
and on
otherwise they evaluate to false
and true
.
This removes a bunch of offenses because we do allow:
context 'on homepage' do
...
end
Follow-up of !92980 (merged).
Screenshots or screen recordings
Configuration via: rubocop --show-cops | rg --multiline --multiline-dotall "RSpec/ContextWording:.*?\n$\n"
Before
RSpec/ContextWording:
Description: Checks that `context` docstring starts with an allowed prefix.
Enabled: true
Prefixes:
- when
- with
- without
- for
- and
- true
- in
- as
- if
VersionAdded: '1.20'
VersionChanged: 1.20.1
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
After
RSpec/ContextWording:
Description: Checks that `context` docstring starts with an allowed prefix.
Enabled: true
Prefixes:
- when
- with
- without
- for
- and
- 'on'
- in
- as
- if
VersionAdded: '1.20'
VersionChanged: 1.20.1
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
Diff
--- before 2022-08-03 22:22:11.065403211 +0200
+++ after 2022-08-03 22:22:05.361487381 +0200
@@ -7,7 +7,7 @@
- without
- for
- and
- - true
+ - 'on'
- in
- as
- if
How to set up and validate locally
bin/rake rubocop:todo:generate[RSpec/ContextWording]
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen