class RuboCop::Cop::Lint::UselessElseWithoutRescue
This cop checks for useless `else` in `begin..end` without `rescue`.
@example
# bad begin do_something else do_something_else # This will never be run. end
@example
# good begin do_something rescue handle_errors else do_something_else end
Constants
- MSG
Private Instance Methods
alternative_message(_diagnostic)
click to toggle source
# File lib/rubocop/cop/lint/useless_else_without_rescue.rb, line 40 def alternative_message(_diagnostic) MSG end
relevant_diagnostic?(diagnostic)
click to toggle source
# File lib/rubocop/cop/lint/useless_else_without_rescue.rb, line 36 def relevant_diagnostic?(diagnostic) diagnostic.reason == :useless_else end