Sha256: 32eb22bf5b6c3c7a5ab7be3a9c9cc4001a82d28ae974352906e1269950c1a344

Contents?: true

Size: 474 Bytes

Versions: 5

Compression:

Stored size: 474 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

          ensure_body.each_node(:return) do |return_node|
            add_offense(return_node, :expression)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/lint/ensure_return.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.27.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.26.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.26.0 lib/rubocop/cop/lint/ensure_return.rb