Ruby

Ruby

Made by DeepSource

Found then keyword in multi-line pattern matching statement RB-C1015

Anti-pattern
Minor
Autofix

The then keyword in pattern match cases is meant to be used for single-expression cases. In case you have a pattern whose body is on multiple lines, the then keyword is not needed.

Bad practice

case expression
in pattern then
    do_something
end

Recommended

case expression
in pattern
    do_something
end

# `then` is recommended for a single-line pattern match statement
case expression
in pattern then do_something
end

# `then` is still valid if `do_something` has it arguments in multiple lines
case expression
in pattern then do_something(arg1,
                             arg2)
end