Why this matters
Writing multiple statements on a single line reduces readability and makes debugging harder. Separate statements should be placed on different lines for clarity.
Ensure that multiple statements are not written on the same line. Each statement should be placed on a new line to improve readability.
Writing multiple statements on a single line reduces readability and makes debugging harder. Separate statements should be placed on different lines for clarity.
Side-by-side examples engineers can pattern-match during review.
if someCondition; puts "hello"; end # Noncompliant
if someCondition
puts "hello"
endif someCondition; puts "hello"; end # Noncompliant
if someCondition
puts "hello"
endFrom the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.