-
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
Fix E30X
panics on blank lines with trailing white spaces
#9907
Conversation
47e801b
to
579dfb5
Compare
Thanks for looking into the panic. I'm reluctant to just remove the assertion without better understanding the reason why it is incorrect (I added it to guarantee it's only called on two directly following lines). Would you mind adding an example explaining why the two ranges don't end and start at the same position to the PR summary? |
@MichaReiser This happens because of the whitespaces, I added an explanation to the PR summary. |
Thanks for the explanation. That makes sense |
Summary
closes #9906
The #9906 issue is triggered by blank lines with trailing white spaces. The trailing spaces cause the
assert_eq!
that was added in this discussion to fail.This PR removes the
assert_eq!
.Test Plan
I tested the change on the python files provided in #9906 (on top of cargo test).
I also added a few fixtures with blank lines with trailing white spaces.
Issue example/explaination
The issue is triggered by blank lines with trailing white spaces.
For example, by creating a blank file with
echo "\n \n" >> temp.py
, we get the snippet given in the issue:Running ruff on this, we get the following tokens:
We can see that the end of the first token range's end and the second token range's start do not match because of the 5 spaces.