Sha256: 90f827e5e503db26b1ee6893d518248e9b2a9b737ef30589752c506c0af02917

Contents?: true

Size: 475 Bytes

Versions: 15

Compression:

Stored size: 475 Bytes

Contents

# encoding: utf-8

module RuboCop
  module Cop
    module Lint
      # This cop checks for *return* from an *ensure* block.
      class EnsureReturn < Cop
        MSG = 'Do not 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

15 entries across 15 versions & 1 rubygems

Version Path
rubocop-0.35.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.35.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.34.2 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.34.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.34.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.33.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.32.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.32.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.31.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.30.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.30.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.29.1 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.29.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.28.0 lib/rubocop/cop/lint/ensure_return.rb
rubocop-0.27.1 lib/rubocop/cop/lint/ensure_return.rb