Sha256: 22dd8fcfdba9b200f8c1016fd2b38de00dffb2a8172cb9a419ec5f941fc56a90

Contents?: true

Size: 618 Bytes

Versions: 12

Compression:

Stored size: 618 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 #:nodoc:
          super
          @interesting_nodes = [:resbody]
        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

12 entries across 12 versions & 2 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.3.0 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.3.1 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.4.0 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.4.1 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.4.2 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.5.0 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.5.1 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.5.2 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
simplabs-excellent-1.5.3 lib/simplabs/excellent/checks/empty_rescue_body_check.rb
excellent-1.5.4 lib/simplabs/excellent/checks/empty_rescue_body_check.rb