Skip to content

Files

Latest commit

 

History

History
74 lines (56 loc) · 942 Bytes

Lint-EmptyConditionalBody.md

File metadata and controls

74 lines (56 loc) · 942 Bytes

Pattern: Empty conditional body

Issue: -

Description

This rule checks for the presence of if, elsif and unless branches without a body.

Examples

# bad
if condition
end

# bad
unless condition
end

# bad
if condition
  do_something
elsif other_condition
end

# good
if condition
  do_something
end

# good
unless condition
  do_something
end

# good
if condition
  do_something
elsif other_condition
  do_something_else
end

AllowComments: true (default)

# good
if condition
  do_something
elsif other_condition
  # noop
end

AllowComments: false

# bad
if condition
  do_something
elsif other_condition
  # noop
end

Configurable attributes

Name Default value Configurable values
AllowComments true Boolean

Further Reading