-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 FP used-before-assignment
for statements guarded under same test
#8581
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8581 +/- ##
=======================================
Coverage 95.91% 95.92%
=======================================
Files 174 174
Lines 18371 18411 +40
=======================================
+ Hits 17620 17660 +40
Misses 751 751
|
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, the primer result bring joy to my heart.
return None | ||
|
||
if give_me_none(): | ||
print(ALL_DONE) # [used-before-assignment] |
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.
I like those tests π
@@ -819,6 +822,38 @@ def _uncertain_nodes_in_false_tests( | |||
|
|||
return uncertain_nodes | |||
|
|||
@staticmethod | |||
def _node_guarded_by_same_test(node: nodes.NodeNG, other_if: nodes.If) -> bool: | |||
"""Identify if `node` is guarded by an equivalent test as `other_if`. |
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's a lot of inference here, but the primer time vary in the same range than it usually does, so the performance impact is probably acceptable.
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, I'm assuming that all of these nodes are inferred anyway elsewhere in the variables checker, so we're hitting the cache.
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/2.17.x maintenance/2.17.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/2.17.x
# Create a new branch
git switch --create backport-8581-to-maintenance/2.17.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f45bf090a8e20c9fb09d61ed67d7f885ad354f85
# Push it to GitHub
git push --set-upstream origin backport-8581-to-maintenance/2.17.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/2.17.x Then, create a pull request where the |
I think this is going very hard to backport (I tried but there's a lot of concurrent changes), what do you think @jacobtylerwalls ? |
I tried also. I'm okay waiting for the 3.0 beta for this. music21 can always use bleeding-edge pylint π‘οΈ |
Type of Changes
Description
Closes #8167