class RuboCop::Cop::Lint::EmptyInPattern
end
# noop
in [a, b]
do_something
in [a]
case condition
# bad
@example AllowComments: false
end
# noop
in [a, b]
do_something
in [a]
case condition
# good
@example AllowComments: true (default)
end
nil
in [a, b]
do_something
in [a]
case condition
# good
end
in [a, b]
do_something
in [a]
case condition
# bad
@example
Checks for the presence of ‘in` pattern branches without a body.
def on_case_match(node)
def on_case_match(node) node.in_pattern_branches.each do |branch| next if branch.body next if cop_config['AllowComments'] && contains_comments?(branch) add_offense(branch) end end