Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Update: for-direction detection false positives/negatives #11254
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
What changes did you make? (Give an overview)
I updated the for-direction rule to prevent false positives and false negatives.
Is there anything you'd like reviewers to focus on?
platinumazure left a comment
Thanks for contributing! Left one inline note.
In addition: Could you please add tests (if not already present) for cases where the for increment direction "could be wrong" but the step size is a variable?
for(var i = 0; i < MAX; i -= STEP_SIZE);
To me, those examples should be valid because we don't know if STEP_SIZE is positive or negative.
Also, since this change can introduce more warnings, the commit summary tag should say "Update". Would you mind making that change as well? (Simplest way to do that is to push new commits without squashing, then edit the PR title.)