ruff
4454fbf7 - Fix `E251` false positive inside f-strings (#7894)

Commit
2 years ago
Fix `E251` false positive inside f-strings (#7894) ## Summary This PR fixes the bug where the rule `E251` was being triggered on a equal token inside a f-string which was used in the context of debug expressions. For example, the following was being flagged before the fix: ```python print(f"{foo = }") ``` But, now it is not. This leads to false negatives such as: ```python print(f"{foo(a = 1)}") ``` One solution would be to know if the opened parentheses was inside a f-string or not. If it was then we can continue flagging until it's closed. If not, then we should not flag it. ## Test Plan Add new test cases and check that they don't raise any false positives. fixes: #7882
Author
Parents
Loading