Comment

Comment by ukoki

> # 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
parent ukoki 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton