-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
def f
string = "a"
last_c = false
while string.size < 11
if string[-1] == 'c'
string += "b"
last_c = false
else
string += "c"
last_c = true
end
end
last_c
end
Expected behavior
No Lint/UselessAssignment
offenses
Actual behavior
test.rb:5:7: W: [Correctable] Lint/UselessAssignment: Useless assignment to variable - string. (https://rubystyle.guide#underscore-unused-vars)
string += "b"
Steps to reproduce the problem
Run provided code on latest RuboCop version.
Likely caused by #14377
RuboCop version
1.79.0 (using Parser 3.3.8.0, Prism 1.4.0, parser_prism, rubocop-ast 1.46.0, analyzing as Ruby 3.4, running on ruby 3.4.4) [x86_64-linux]
mscrivo, ntkme, franzliedke and jacksonhuether