class RuboCop::Cop::Lint::HandleExceptions

end
# do nothing but comment
rescue
do_something
begin
# good
end
# do nothing but comment
rescue
do_something
def some_method
# good
end
rescue
do_something
begin
# bad
end
rescue
do_something
def some_method
# bad
@example AllowComments: true
end
handle_exception
rescue
do_something
begin
# good
end
handle_exception
rescue
do_something
def some_method
# good
end
# do nothing
rescue
do_something
begin
# bad
end
rescue
do_something
begin
# bad
end
# do nothing
rescue
do_something
def some_method
# bad
end
rescue
do_something
def some_method
# bad
@example AllowComments: false (default)
This cop checks for rescue blocks with no body.

def comment_lines?(node)

def comment_lines?(node)
  processed_source[line_range(node)].any? { |line| comment_line?(line) }
end

def on_resbody(node)

def on_resbody(node)
  return if node.body
  return if cop_config['AllowComments'] && comment_lines?(node)
  add_offense(node)
end