Fix Rubocop Style/IfUnlessModifier offences
What does this MR do and why?
Fix Rubocop Style/IfUnlessModifier
offences.
❯ REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --show-cops Style/IfUnlessModifier
# Supports --autocorrect
Style/IfUnlessModifier:
Description: Favor modifier if/unless usage when you have a single-line body.
StyleGuide: "#if-as-a-modifier"
Enabled: true
VersionAdded: '0.9'
VersionChanged: '0.30'
The code this is MR is autocorrected by running the following commands.
$ REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --only Style/IfUnlessModifier --parallel -a app/finders/**/*.rb
$ REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --only Style/IfUnlessModifier --parallel -a app/graphql/**/*.rb
$ bundle exec rake rubocop:todo:generate[Style/IfUnlessModifier]
Generating RuboCop TODOs with:
rubocop --parallel --format RuboCop::Formatter::TodoFormatter --only Style/IfUnlessModifier
This might take a while...
Written to .rubocop_todo/style/if_unless_modifier.yml
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Running this command should not result in error.
$ bundle exec rubocop --only Style/IfUnlessModifier --parallel