Pattern: Empty else
clause
Issue: -
Checks for empty else
clauses, possibly including comments and/or an explicit nil
depending on the enforced style.
SupportedStyles:
# good for all styles
if condition
statement
else
statement
end
# good for all styles
if condition
statement
end
# empty - warn only on empty else
# bad
if condition
statement
else
end
# good
if condition
statement
else
nil
end
# nil - warn on else with nil in it
# bad
if condition
statement
else
nil
end
# good
if condition
statement
else
end
# both - warn on empty else and else with nil in it
# bad
if condition
statement
else
nil
end
# bad
if condition
statement
else
end
Attribute | Value |
---|---|
EnforcedStyle | both |
SupportedStyles | empty, nil, both |