Sha256: 3bcd567690e1e787b6c6eed9c7fedc31227b0d752a2a846efccd70a665403253

Contents?: true

Size: 650 Bytes

Versions: 4

Compression:

Stored size: 650 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      # This check reports empty +rescue+ blocks. Empty +rescue+ blocks suppress all errors which is usually not a good technique.
      #
      # ==== Applies to
      #
      # * +rescue+ blocks
      class EmptyRescueBodyCheck < Base

        def initialize(options = {}) #:nodoc:
          super
          @interesting_contexts = [Parsing::ResbodyContext]
        end

        def evaluate(context) #:nodoc:
          add_warning(context, 'Rescue block is empty.', {}, -1) unless context.has_statements?
        end

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
excellent-2.1.1 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
excellent-2.1.0 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
excellent-2.0.1 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
excellent-2.0.0 lib/simplabs/excellent/checks/empty_rescue_body_check.rb