-
Notifications
You must be signed in to change notification settings - Fork 1.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
ruff format
moves # noqa
comment to wrong location
#10281
Comments
Oh hmm, this looks like a bug, thanks. Will look into it. The only workaround I could think of is using import typing
def foo(
__bar: str,
/,
**specifiers: typing.Any, # noqa: ANN401
) -> int: # fmt: skip
return len(specifiers) |
This is why we need a programming language that doesn't allow comments 😂 |
Or an FYI: This is not specific to noqa. We incorrectly associate any end-of-line comment https://play.ruff.rs/cb2a370c-ae53-48a5-a35f-810b9c537ae2 I suspect that the error is somewhere in
|
## Summary Fixes the handling end of line comments that belong to `**kwargs` when the `**kwargs` come after a slash. The issue was that we missed to include the `**kwargs` start position when determining the start of the next node coming after the `/`. Fixes #10281 ## Test Plan Added test
Thanks @MichaReiser and everyone else at https://github.com/astral-sh! You rock 🚀 |
## Summary Fixes the handling end of line comments that belong to `**kwargs` when the `**kwargs` come after a slash. The issue was that we missed to include the `**kwargs` start position when determining the start of the next node coming after the `/`. Fixes astral-sh#10281 ## Test Plan Added test
I would like to switch my codebase to
ruff format
, but there is one annoying issue that breaks my use case: Some# noqa
comments are moved resulting in issues when callingruff check
.Hers's a minimal code snippet to demonstrate what happens:
I assume this issue is an edge case that has to do with the keyword-only
/
syntax being used. Are there any workarounds available?The text was updated successfully, but these errors were encountered: