-
-
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
fix(4716): fix false positive unnecessary_dict_index_lookup
emitted when del
is used
#5344
Conversation
Pull Request Test Coverage Report for Build 1536340558
π - Coveralls |
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.
Two valuable additions in quick succession π One additional test but rest looks good!
We'll need to move the changelog for 2.13
again, but I'll add the blocked
label to indicate this!
unnecessary-dict-index-lookup:60:1:60:11::Unnecessary dictionary index lookup, use 'item[1]' instead:UNDEFINED | ||
unnecessary-dict-index-lookup:65:10:65:20::Unnecessary dictionary index lookup, use 'item[1]' instead:UNDEFINED | ||
unnecessary-dict-index-lookup:82:14:82:18::Unnecessary dictionary index lookup, use '_' instead:UNDEFINED | ||
unnecessary-dict-index-lookup:7:10:None:None::Unnecessary dictionary index lookup, use 'v' instead:UNDEFINED |
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.
Are you by any chance working on Python < 3.8?
The end line and end column information of these messages should be added here, they seem to have been transformed into None
due to the auto-updater. This is probably also going to fail the test.
@Pierre-Sassoulas Shall we make the updater only accessible on > 3.7? Or make it put out a warning on lower versions?
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.
Yes we need a run time error if the upgrade would be useless in CI. #5418 is ideal for that I guess ?
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.
Yeah! Seems like a good idea. For now 3.8
is good enough since we don't have any nodes that only have their end_column
data on 3.9 or 3.10. I think an exception when trying to run and a small explanation on why 3.8 is necessary should do.
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.
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.
my bad let me switch my environments
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.
Very nice light fix, thank you !
Type of Changes
Description
Add simple logic to check subscript's parent to see if it's
Delete
and ignore the rest check if so to prevent false positive emitted when performing index lookup for deletion of an dictionary entryCloses #4716