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

Useless assignment to variable issue. #804

Closed
askreet opened this issue Feb 8, 2014 · 1 comment · Fixed by #807
Closed

Useless assignment to variable issue. #804

askreet opened this issue Feb 8, 2014 · 1 comment · Fixed by #807
Assignees

Comments

@askreet
Copy link

askreet commented Feb 8, 2014

This code produces a "Useless assignment to variable - tries" error, which is not true.

def function_that_retries
  tries = 1
  begin
    foo = bar
    raise 'failure'
  rescue
    if foo =~ /bar/
      retry if (tries += 1) <= 3
    else
      raise SomethingBad, 'Something is really broken.'
    end
  end
end

I broke it down to this minimum sample, and it seems to be that the conditional (retry if ()) doesn't count as a use of the variable.

@yujinakayama
Copy link
Collaborator

Thanks for the report. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants