# frozen_string_literal: true module RuboCop module Cop module Naming # In Ruby 3.1, anonymous block forwarding has been added. # # This cop identifies places where `do_something(&block)` can be replaced # by `do_something(&)`. # # It also supports the opposite style by alternative `explicit` option. # You can specify the block variable name for autocorrection with `BlockForwardingName`. # The default variable name is `block`. If the name is already in use, it will not be # autocorrected. # # @example EnforcedStyle: anonymous (default) # # # bad # def foo(&block) # bar(&block) # end # # # good # def foo(&) # bar(&) # end # # @example EnforcedStyle: explicit # # # bad # def foo(&) # bar(&) # end # # # good # def foo(&block) # bar(&block) # end # class BlockForwarding < Base include ConfigurableEnforcedStyle include RangeHelp extend AutoCorrector extend TargetRubyVersion minimum_target_ruby_version 3.1 MSG = 'Use %