Sha256: 7238f1d268a5603c8b8f57a40f316f874846e84b9cb227c27be670eb2a164fa7

Contents?: true

Size: 584 Bytes

Versions: 3

Compression:

Stored size: 584 Bytes

Contents

# encoding: utf-8

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.'

        def on_def(node)
          check(node)
          super
        end

        def on_defs(node)
          check(node)
          super
        end

        private

        def check(node)
          on_node(:postexe, node) do |end_node|
            add_offence(:warning, end_node.loc.keyword, MSG)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 lib/rubocop/cop/lint/end_in_method.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/lint/end_in_method.rb
rubocop-0.9.0 lib/rubocop/cop/lint/end_in_method.rb