class RuboCop::Cop::Lint::UselessElseWithoutRescue

end
do_something_else
else
handle_errors
rescue
do_something
begin
# good
@example
end
do_something_else # This will never be run.
else
do_something
begin
# bad
@example
NOTE: This syntax is no longer valid on Ruby 2.6 or higher.
Checks for useless ‘else` in `begin..end` without `rescue`.

def on_new_investigation

def on_new_investigation
  processed_source.diagnostics.each do |diagnostic|
    next unless diagnostic.reason == :useless_else
    add_offense(diagnostic.location, severity: diagnostic.level)
  end
end