class RuboCop::Cop::Style::ItAssignment

foo { bar = _2 }
foo { |bar| var = bar }
foo { var = 5 }
# good - use a different variable name
foo { it = _2 }
foo { |bar| it = bar }
foo { it = 5 }
# bad
@example
parameters, even though ‘it` cannot be used in those cases.
For consistency, this also applies to numblocks and blocks with
cause confusion if `it` is used as a block parameter elsewhere.
Although Ruby allows reassigning `it` in these cases, it could
where `it` can refer to the first anonymous parameter as of Ruby 3.4.
Checks for assignments to a local `it` variable inside a block

def on_lvasgn(node)

def on_lvasgn(node)
  return unless node.name == :it
  return unless node.each_ancestor(:any_block).any?
  add_offense(node.loc.name)
end