Skip to content

Enable Style/NegatedIf Rubocop cop

Grzegorz Bizon requested to merge rubocop/enable-negatedif-style-cop into master

Favor unless over if for negative conditions (or control flow ||).

# bad
do_something if !some_condition
# bad
do_something if not some_condition

# good
do_something unless some_condition
# good
some_condition || do_something

See #17478 (closed)

Merge request reports