Sha256: cec7c67e3f081a84be491720f8e7913c90fb24343ff27db4f27e6c8805eb8474
Contents?: true
Size: 651 Bytes
Versions: 16
Compression:
Stored size: 651 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for END blocks. # # @example # # bad # END { puts 'Goodbye!' } # # # good # at_exit { puts 'Goodbye!' } # class EndBlock < Cop MSG = 'Avoid the use of `END` blocks. ' \ 'Use `Kernel#at_exit` instead.' def on_postexe(node) add_offense(node, location: :keyword) end def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.keyword, 'at_exit') end end end end end end
Version data entries
16 entries across 16 versions & 3 rubygems