Sha256: 14f9c280d7e02e1b42b706f50b5a4d53e61bb01d179817c12ce89ed009e728a3
Contents?: true
Size: 939 Bytes
Versions: 6
Compression:
Stored size: 939 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Lint # Checks for useless `else` in `begin..end` without `rescue`. # # NOTE: This syntax is no longer valid on Ruby 2.6 or higher. # # @example # # # bad # begin # do_something # else # do_something_else # This will never be run. # end # # # good # begin # do_something # rescue # handle_errors # else # do_something_else # end class UselessElseWithoutRescue < Base MSG = '`else` without `rescue` is useless.' 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 end end end end
Version data entries
6 entries across 6 versions & 1 rubygems