You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following code, the first assignment to ret is not useless if the loop does not execute:
def while(param)
ret = 1
while param != 10
param += 2
ret = param + 1
end
ret
end
However, rubocop emits the following:
loop_assignment_testcase.rb:2:3: W: Useless assignment to variable - ret.
ret = 1
^^^
this was checked against master:
0.36.0 (using Parser 2.3.0.1, running on ruby 2.2.3 x86_64-darwin14)
I suggest that since the loop is only conditionally executed, the earlier assignment to ret should not be considered useless, as is done for if expressions.
The text was updated successfully, but these errors were encountered:
In the following code, the first assignment to
ret
is not useless if the loop does not execute:However, rubocop emits the following:
this was checked against master:
I suggest that since the loop is only conditionally executed, the earlier assignment to
ret
should not be considered useless, as is done forif
expressions.The text was updated successfully, but these errors were encountered: