Class: Rubocop::Cop::HandleExceptions
- Defined in:
- lib/rubocop/cop/handle_exceptions.rb
Constant Summary collapse
- ERROR_MESSAGE =
'Do not suppress exceptions.'
Instance Attribute Summary
Attributes inherited from Cop
#correlations, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #name
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#inspect(file, source, tokens, sexp) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubocop/cop/handle_exceptions.rb', line 8 def inspect(file, source, tokens, sexp) each(:begin, sexp) do |s| each(:rescue, s) do |rs| if rs[3] == [[:void_stmt]] add_offence(:warning, all_positions(s)[-1].lineno + 1, ERROR_MESSAGE) end end end end |