Sha256: 1961c6eaf9d1a798baed233fb94c9bb93d421e239878851f8efae00320fa614f

Contents?: true

Size: 369 Bytes

Versions: 4

Compression:

Stored size: 369 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Lint
      # This cop checks for empty `ensure` blocks
      class EmptyEnsure < Cop
        MSG = 'Empty ensure block detected.'

        def on_ensure(node)
          _body, ensure_body = *node

          add_offence(:warning, node.loc.keyword, MSG) unless ensure_body
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/cop/lint/empty_ensure.rb
rubocop-0.11.1 lib/rubocop/cop/lint/empty_ensure.rb
rubocop-0.11.0 lib/rubocop/cop/lint/empty_ensure.rb
rubocop-0.10.0 lib/rubocop/cop/lint/empty_ensure.rb