-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Python: Shared dataflow, conditionals #4414
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
Conversation
Also use better formatter (better because comments are close to what they comment)
| # 6.2.3. Parenthesized forms | ||
| def test_parenthesized_form(): | ||
| x = (SOURCE) | ||
| x = SOURCE |
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.
Did the formatter get a bit aggressive here?
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.
Hah, probably. I missed that, thanks!
RasmusWL
left a comment
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.
It would be super nice if you always put autoformatting commits in a separate commit, since it makes things a bit easier to scan. Now the title of 8f13d58 Python: More tests of conditonals lead me to believe that there would be new test-cases, but after looking through the diff of the test.py file 3 times, I haven't found any. Maybe just confusing commit message? (at least consider me confused)
Otherwise, I think we need to restore the parenthesis test. code-formatters are pretty nice, but sometimes it just doesn't do what we want :( besides this, change LGTM 👍
|
There are two new tests in there: 8f13d58#diff-601e823041b1218704b390c8387e5bb6R412-R426 |
Nah, lets just keep it in mind moving forwards 👍 |
This PR adds flow from the operands of
IfExprNodes to the nodes themselves. It leans on the logic already implemented to exclude false positives in simple cases.The dataflow step is simply added to
essaFlowStep; we should perhaps rename that predicate...Since I added new test cases to demonstrate that some false positives do not appear, I also formatted the test file with my new formatter of choice (black). This means that many line numbers are shifted, but the upside is that comments are closer to what they comment than to the definition above rather than the other way around. It also saves som lines overall.
Reading the commits in order might help, since all line shifting happens on the first commit.