-
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
COM812 breaks conditionals inside multi-line f-strings #8556
Labels
bug
Something isn't working
Comments
Thanks, I'll take a look at this! |
I think it must be considering the curly braces as |
@dhruvmanila - Feel free to fix if you're there, I won't get to it for a few hours. |
Taking a look now. |
charliermarsh
added a commit
that referenced
this issue
Nov 9, 2023
dhruvmanila
added a commit
that referenced
this issue
Nov 10, 2023
## Summary This fixes the bug where the `flake8-commas` rules weren't taking the new f-string tokens into account. ## Test Plan Add new test cases around f-strings for all of `flake8-commas`'s rules. fixes: #8556
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Synopsis
The COM812 rule is capable of breaking conditional statements within triple f-strings by converting the else-statement into a tuple (or a tuple containing the original tuple).
Of course you can use
# noqa: COM812
, though I think that linters should be incapable of breaking code.MRE
(This example assumes the line should be split across multiple lines.)
Original mre.py:
"Fixed" mre.py
$ py test.py This is a test. ('Another sentence.',) $ ruff check mre.py (Exit code 0)
Environment
The text was updated successfully, but these errors were encountered: