We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
No offense with Lint/ShadowingOuterLocalVariable cop
W: Lint/ShadowingOuterLocalVariable: Shadowing outer local variable - item. items.each { |item| frobnicate(item) } ^^^^
def do_something(items, what) if what == :first item = items[0] frobnicate(item) elsif what == :second item = items[1] frobnicate(item) else items.each { |item| frobnicate(item) } end end rubocop --only Lint/ShadowingOuterLocalVariable
Removing the elsif does not cause the warning to be emitted (see #10479)
elsif
%% rubocop -V 1.35.1 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.1.2 x86_64-darwin21)
The text was updated successfully, but these errors were encountered:
Lint/ShadowingOuterLocalVariable
[Fix rubocop#10962] Fix a false positive for `Lint/ShadowingOuterLoca…
26c0ff1
…lVariable` when conditional with if/elsif/else branches Fix: rubocop#10962
Merge pull request #10968 from ydah/fix/10962
ab807f9
[Fix #10962] Fix a false positive for `Lint/ShadowingOuterLocalVariable` when conditional with if/elsif/else branches
Successfully merging a pull request may close this issue.
Expected behavior
No offense with Lint/ShadowingOuterLocalVariable cop
Actual behavior
Steps to reproduce the problem
Removing the
elsif
does not cause the warning to be emitted (see #10479)RuboCop version
The text was updated successfully, but these errors were encountered: