Sha256: eaa2e5f2645daf8604112c658e43e4d67e485771ee641ab3817b865419f2adbe
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module Lint # This cop checks for *rescue* blocks with no body. # # @example # # # bad # def some_method # do_something # rescue # end # # # bad # begin # do_something # rescue # end # # # good # def some_method # do_something # rescue # handle_exception # end # # # good # begin # do_something # rescue # handle_exception # end # # @example AllowComments: true (default) # # # good # def some_method # do_something # rescue # # do nothing # end # # # good # begin # do_something # rescue # # do nothing # end # # @example AllowComments: false # # # bad # def some_method # do_something # rescue # # do nothing # end # # # bad # begin # do_something # rescue # # do nothing # end class SuppressedException < Cop MSG = 'Do not suppress exceptions.' def on_resbody(node) return if node.body return if cop_config['AllowComments'] && comment_lines?(node) add_offense(node) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.83.0 | lib/rubocop/cop/lint/suppressed_exception.rb |