Ruby

Ruby

Made by DeepSource

Consider writing method chains on separate lines RB-W1010

Anti-pattern
Minor
Autofix

Method chains that are written on a single line can become difficult to read and understand, particularly when the chain is long. This can lead to errors or bugs that are hard to spot and fix.

By placing each method call on a separate line, the code becomes easier to read and maintain, improving overall code quality and reducing the risk of errors.

Bad practice

items.select { |item| item.cond? }.join('-').each { |item| puts item }

Recommended

items.select { |item| item.cond? }
     .join('-')
     .each { |item| puts item }