class RuboCop::Cop::Style::MethodCallWithoutArgsParentheses
def parenthesized_it_method_in_block?(node)
Ruby 3.4; use it() or self.it
-e:1: warning: `it` calls without arguments will refer to the first block param in
$ ruby -e '0.times { begin; it; end }'
Respects `Lint/ItWithoutArgumentsInBlock` cop and the following Ruby 3.3's warning:
def parenthesized_it_method_in_block?(node) return false unless node.method?(:it) return false unless (block_node = node.each_ancestor(:block).first) return false unless block_node.arguments.empty_and_without_delimiters? !node.receiver && node.arguments.empty? && !node.block_literal? end