Sha256: 8c392ec2283f05de8e3d5c57d0f0d4fb434d0b73ed2804b6426a04a4fa5e49b0

Contents?: true

Size: 447 Bytes

Versions: 5

Compression:

Stored size: 447 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Lint
      # This cop checks for *return* from an *ensure* block.
      class EnsureReturn < Cop
        MSG = 'Never return from an ensure block.'

        def on_ensure(node)
          _body, ensure_body = *node

          return unless ensure_body

          on_node(:return, ensure_body) do |e|
            warning(e, :expression)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.14.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.14.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.13.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.13.0 lib/rubocop/cop/lint/ensure_return.rb