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
Lint/UselessAssign
hash = {"foo" => "bar"} def call(v) end unless v = hash["foo"]? call v = "default" end v
Results in:
[W] Lint/UselessAssign: Useless assignment to variable `v` > unless v = hash["foo"]?
The assignment is for sure not useless as it handles assigning v if that key is present in the hash, otherwise is assigned within the unless block.
v
unless
Creating a new issue as unlike #447, this doesn't require any type declarations or macros.
The text was updated successfully, but these errors were encountered:
Reduced:
unless v = rand puts v = 1 end v
puts v = 1 unless v = rand v
Sorry, something went wrong.
I'd say the bug is most likely located somewhere in the AST::ScopeVisitor class, yet I couldn't exactly pinpoint it.
AST::ScopeVisitor
@veelenga any pointers?
4e180d4
veelenga
Successfully merging a pull request may close this issue.
Results in:
The assignment is for sure not useless as it handles assigning
v
if that key is present in the hash, otherwise is assigned within theunless
block.Creating a new issue as unlike #447, this doesn't require any type declarations or macros.
The text was updated successfully, but these errors were encountered: