Sha256: 7fa0aa3eae3af863095ef3b5c3cfb5362b049c0eefe3b2f4674a2dcd6902e80f

Contents?: true

Size: 493 Bytes

Versions: 5

Compression:

Stored size: 493 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class HandleExceptions < Cop
      ERROR_MESSAGE = 'Do not suppress exceptions.'

      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.7.2 lib/rubocop/cop/handle_exceptions.rb
rubocop-0.7.1 lib/rubocop/cop/handle_exceptions.rb
rubocop-0.7.0 lib/rubocop/cop/handle_exceptions.rb
rubocop-0.6.1 lib/rubocop/cop/handle_exceptions.rb
rubocop-0.6.0 lib/rubocop/cop/handle_exceptions.rb