-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Suppress unnecessary-list-index-lookup
for whole loop on write
#6845
Conversation
The ``unnecessary-list-index-lookup`` checker was assuming that if the subscript was written to then it would only invalidate access on later lines, but this is not necessarily the case if an inner loop is nested inside the one being checked. Fixes pylint-dev#6818
I was going to apply the same change to
We could just update the regression test, but I was going to have a go at changing the behavior to detect whether there is a loop of any kind nested within the outer |
Pull Request Test Coverage Report for Build 2478175748
π - Coveralls |
This comment has been minimized.
This comment has been minimized.
I'm not sure I understand the build errors here. It seems to be a problem reported from a Javascript process, so it's not obvious how my changes could have affected it. |
I think it's due to other fails before:
Primer are costly, so if other job fails we cut them short I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit about typing. Change itself looks good to resolve the current issue!
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @timmartin !
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit bd612cf |
β¦ylint-dev#6845) The ``unnecessary-list-index-lookup`` checker was assuming that if the subscript was written to then it would only invalidate access on later lines, but this is not necessarily the case if an inner loop is nested inside the one being checked. Fixes pylint-dev#6818 Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
β¦6845) The ``unnecessary-list-index-lookup`` checker was assuming that if the subscript was written to then it would only invalidate access on later lines, but this is not necessarily the case if an inner loop is nested inside the one being checked. Fixes #6818 Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Type of Changes
Description
The
unnecessary-list-index-lookup
checker was assuming that if thesubscript was written to then it would only invalidate access on later
lines, but this is not necessarily the case if an inner loop is nested
inside the one being checked.
Closes #6818