astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
31.4k stars 1.05k forks source link

Infinite loop in auto-fix between `E203`/`E275` #12094

Closed dhruvmanila closed 3 months ago

dhruvmanila commented 3 months ago

Example code:

pass;

The E275 rule tries to add a whitespace after pass keyword but the E203 tries to remove the whitespace before ;.

dhruvmanila commented 3 months ago

Although, if you add in E703 (useless-semicolon), there won't be an infinite loop because it would remove the semicolon.

AlexWaygood commented 3 months ago

If we're picking sides, I think E203 is correct on this one and E275 has it wrong