rubocop icon indicating copy to clipboard operation
rubocop copied to clipboard

False negative for `Lint/UselessAssignment`

Open vlad-pisanov opened this issue 1 year ago • 0 comments

Consider

x = 1
x = 2
foo {
  x = 3
}

Lint/UselessAssignment doesn't register any offenses, even though the first assignment is useless. Assignment inside the block seems to confuse the cop.

1.66.1 (using Parser 3.3.5.0, rubocop-ast 1.32.3, running on ruby 3.3.2) [x86_64-darwin21]
  - rubocop-factory_bot 2.26.1
  - rubocop-minitest 0.36.0
  - rubocop-performance 1.22.1
  - rubocop-rails 2.26.2

vlad-pisanov avatar Oct 08 '24 18:10 vlad-pisanov