-
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
E203: Incompatible with formatter when closing ]
is on its own line
#10973
Comments
Does |
Can you include the full contents of the file needed to reproduce this? |
Note: I haven't been able to reproduce this by pasting the visible code into the playground. https://play.ruff.rs/f218da06-df69-4979-bd30-aea8d1572447 |
I was able to reproduce it by putting my code in the playground and putting in some of my settings (even without those, I believe): https://play.ruff.rs/d0579912-6c11-41df-b509-78a79b416881. See line 201 Great tool btw! I think the "share" button does not actually copy the link in Safari though... |
Thank you. That was very helpful! Okay I think I have a minimal repro. The linter only warns about the whitespace if the closing bracket is on its own line. |
]
is on its own line
## Summary The fix for E203 now produces the same result as ruff format in cases where a slice ends on a colon and the closing square bracket is on the following line. Refers to #10973 ## Test Plan The minimal reproduction case in the ticket was added as test case producing no error. Additional cases with multiple spaces or a tab before the colon where added to make sure that the rule still finds these.
@MichaReiser Is this resolved by #10999 ? |
Yeah I think so. At least it no longer shows up in the playground. |
I don't think the linked PR is released yet unless you're running it locally 😅 |
I'm just gonna pretend that I tested it locally... But yes, the error no longer shows locally (but still does on play.ruff) |
Ruff version: 0.1.7
OS: MacOS / ArchLinux / RHEL
Python: 3.11.5
I put both
ruff
andruff format
in my pre-commit hooks as follows:Ruff config
When running the hooks the
check --fix
seems to do something thatformat
reverts.Seems to be
ruff format
wanting to add space before colon:The text was updated successfully, but these errors were encountered: