-
Notifications
You must be signed in to change notification settings - Fork 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
# noqa: E702 # fmt: skip
still formats the line of code
#11430
Comments
I think it's because there are two statements on the same line and I'm not exactly sure if this is the intended behavior, @konstin any thoughts here? @MichaReiser will be able to provide more context here but he's currently on PTO until the end of next week. I can possibly look into it to confirm whether this is the intended behavior. |
Iirc the end-of-line format off comment applies to the statement preceding it, and the two prints are two separate statements, but micha will know better |
Oh, that's interesting and not something I have thought of when implementing suppression comments.
Today's behavior matches our documentation. However, Black doesn't format simple statements that end with a I'm open to changing our implementation to support this use case if it doesn't add too much complexity. I otherwise recommend documenting the deviation because it's possible to suppress the example using # fmt: off
print(); print() # noqa
# fmt: on
print( ) |
yep. basically, I banged my head a few hours to figure this out. Black doesn't format the line which has more than one statement and tagged with "# fmt: skip" |
thank you for writing this issue. |
Related: #11216. |
Input code:
After formatting:
# fmt: on/off
works fine though, but I want to have just one line of short boilerplate code.I'm using the Ruff VS Code extension, which is said to ship with
ruff==0.4.1
The text was updated successfully, but these errors were encountered: