-
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
Infinite loop with invalid syntax #10295
Labels
bug
Something isn't working
fixes
Related to suggested fixes for violations
help wanted
Contributions especially welcome
Comments
I think it's because the auto-fix for |
dhruvmanila
added
bug
Something isn't working
fixes
Related to suggested fixes for violations
labels
Mar 8, 2024
hoel-bagard
added a commit
to hoel-bagard/ruff
that referenced
this issue
Mar 9, 2024
hoel-bagard
added a commit
to hoel-bagard/ruff
that referenced
this issue
Mar 9, 2024
charliermarsh
pushed a commit
that referenced
this issue
Mar 11, 2024
…is a ')' (#10315) ## Summary Fixes #10295. `E225` (`Missing whitespace around operator`) and `E275` (`Missing whitespace after keyword`) try to add a white space even when the next character is a `)` (which is a syntax error in most cases, the exceptions already being handled). This causes `E202` (`Whitespace before close bracket`) to try to remove the added whitespace, resulting in an infinite loop when `E225`/`E275` re-add it. This PR adds an exception in `E225` and `E275` to not trigger in case the next token is a `)`. It is a bit simplistic, but it solves the example given in the issue without introducing a change in behavior (according to the fixtures). ## Test Plan `cargo test` and the `ruff-ecosystem` check were used to check that the PR's changes do not have side-effects. A new fixture was added to check that running the 3 rules on the example given in the issue does not cause ruff to fail to converge.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
fixes
Related to suggested fixes for violations
help wanted
Contributions especially welcome
With this invalid syntax
I get with ruff v0.3.1
Not sure if it is really a bug given the invalid syntax, but the output could be nicer.
The text was updated successfully, but these errors were encountered: