Why this matters
Empty code blocks make it unclear whether they are placeholders for future logic or mistakenly left blank. Always remove them or add a comment explaining their purpose.
Check for empty code blocks (such as `if` or `loop` structures) that do not contain any statements. If an empty block is present, ensure it includes a comment explaining its purpose.
Empty code blocks make it unclear whether they are placeholders for future logic or mistakenly left blank. Always remove them or add a comment explaining their purpose.
Side-by-side examples engineers can pattern-match during review.
// (no example provided)def compute(a, b)
sum = a + b
if sum > 0 # Noncompliant: is the block empty on purpose, or is code missing?
end
puts "Result: #{sum}"
enddef compute(a, b)
sum = a + b
if sum > 0 # Noncompliant: is the block empty on purpose, or is code missing?
end
puts "Result: #{sum}"
endFrom the same buckets as this rule.