Sha256: d48e915fdbf7b8691fe59186cf682064223d339ff3dae8c32b3962f0541f4926

Contents?: true

Size: 451 Bytes

Versions: 11

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Lint
      # This cop checks for END blocks in method definitions.
      class EndInMethod < Cop
        MSG = '`END` found in method definition. Use `at_exit` instead.'.freeze

        def on_postexe(node)
          inside_of_method = node.each_ancestor(:def, :defs).count.nonzero?
          add_offense(node, :keyword) if inside_of_method
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/end_in_method.rb
rubocop-0.46.0 lib/rubocop/cop/lint/end_in_method.rb
rubocop-0.45.0 lib/rubocop/cop/lint/end_in_method.rb
rubocop-0.44.1 lib/rubocop/cop/lint/end_in_method.rb
rubocop-0.44.0 lib/rubocop/cop/lint/end_in_method.rb