環境
- rubocop 1.30.0
- Ruby 3.1.0
エラー内容
Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
if文の中身が1行の場合は、後置ifを使用するか、&&
または||
を使用してください。
エラー対処法
# bad if some_condition do_something end # good do_something if some_condition # another good option some_condition && do_something