-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat(rules): Add rule to check for mutations of loop iterator #446
feat(rules): Add rule to check for mutations of loop iterator #446
Conversation
46c0de7
to
fd4e612
Compare
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.
Many thanks for this. Looks good. I like this starting point.
Can you please:
- Lets go with b038
- Add more detailed few lines explanation into READNE.rst
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.
Many thanks for your contribution!
Will get a release our next week.
I have an example for a false positive (I hope), if it's desired. id_pos = 0
# lf is LogFile not LazyFrame
lf = self._logger
with self.rlock:
lf.seek(0, 0)
cpos = lf.tell()
for line in lf:
if len(line.strip()) == 0:
continue
sl = line.split(b",", 1)
self._mapper[sl[id_pos]] = cpos
cpos = lf.tell() Desired behavior is to find all indexes and record the file position where they start. |
This implements a POC for #445.
I opted to go the route of alerting for any mutations of a loop iterator.
Note:
I picked B999 temporarily, not sure how the numbers are picked.
Also, I'm very much open to change the error message.
Would be happy if you could give this a review @cooperlees 🙂