class RuboCop::Cop::Lint::EmptyWhen
end
when baz then 2
when bar then 1
case foo
# good
@example
end
when baz then # nothing
when bar then 1
case foo
# bad
@example
This cop checks for the presence of ‘when` branches without a body.
def on_case(node)
def on_case(node) node.each_when do |when_node| next if when_node.body add_offense(when_node, location: when_node.source_range) end end