Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VariableForce error with for #11919

Closed
andyw8 opened this issue Jun 2, 2023 · 0 comments · Fixed by #11921
Closed

VariableForce error with for #11919

andyw8 opened this issue Jun 2, 2023 · 0 comments · Fixed by #11921
Labels

Comments

@andyw8
Copy link
Contributor

andyw8 commented Jun 2, 2023

Expected behavior

Should parse as valid code.

Actual behavior

Fails with:

An error occurred while VariableForce cop was inspecting example.rb

Steps to reproduce the problem

Create a file containing the following, and run RuboCop against it.

for i in x
end

RuboCop version

v1.52.0

This started failing in v1.51.0, it works on versions before that.

% rubocop -V
1.52.0 (using Parser 3.2.2.1, rubocop-ast 1.28.1, running on ruby 3.2.1) [arm64-darwin22]
  - rubocop-minitest 0.31.0
  - rubocop-rake 0.6.0
  - rubocop-sorbet 0.7.0
@koic koic added the bug label Jun 3, 2023
koic added a commit to koic/rubocop that referenced this issue Jun 3, 2023
Fixes rubocop#11919.

This PR fixes an error for `Lint/UselessAssignment`
when a variable is assigned and unreferenced in `for`.
bbatsov pushed a commit that referenced this issue Jun 4, 2023
Fixes #11919.

This PR fixes an error for `Lint/UselessAssignment`
when a variable is assigned and unreferenced in `for`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants