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 if-cond should not trigger useless-var messaging #1981

Closed
mduvall opened this issue Jun 19, 2015 · 1 comment
Closed

Useless if-cond should not trigger useless-var messaging #1981

mduvall opened this issue Jun 19, 2015 · 1 comment

Comments

@mduvall
Copy link

mduvall commented Jun 19, 2015

The code below returns W: Useless assignment to variable - foo.. This is not so much a useless assignment as a useless condition (since both branches assign the variable to the same evaluated value).

def foo
  if bar
    foo = 1
  else
    foo = 1
  end

  foo.bar.baz
end
@alexdowad
Copy link
Contributor

I'm opening a PR which fixes this.

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

No branches or pull requests

2 participants