class RuboCop::Cop::Lint::EmptyWhen


end
# do nothing
when bar
do_something
when foo
case condition
# bad
@example AllowComments: false
end
# noop
when bar
do_something
when foo
case condition
# good
@example AllowComments: true (default)
end
nil
when bar
do_something
when foo
case condition
# good
@example
end
when baz
do_something
when bar
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
    next if cop_config['AllowComments'] && comment_lines?(node)
    add_offense(when_node)
  end
end