ruff/crates/ruff_linter
Dhruv Manilawala 4454fbf7e5
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
2023-10-12 05:26:39 +00:00
..
resources/test Fix E251 false positive inside f-strings (#7894) 2023-10-12 05:26:39 +00:00
src Fix E251 false positive inside f-strings (#7894) 2023-10-12 05:26:39 +00:00
Cargo.toml Use crates.io unicode_names2 0.6.0 (#6478) 2023-10-02 18:17:38 -04:00