3 ms·
> # This cop checks for `next` (and sometimes `break`) in loops. > ... > # - For small loops, you can just use normal conditions instead of `next`. This
by ukoki 2y ago
> # This cop checks for `next` (and sometimes `break`) in loops.
> ...
> # - For small loops, you can just use normal conditions instead of `next`.
This rule will just end up with devs writing this:
array.each do |elem|
if condition
if another_condition
if yet_another_condition
do_something
end
end
end
end
Rather than the much easier to parse:
array.each do |elem|
next if !condition
next if !another_condition
next if !yet_another_condition
do_something
end
- jdalbert 2y agoThat cop is disabled by default in `config/default.yml`.