ruff
77396c6f - Fix `SIM102` to handle indented `elif` (#6072)

Commit
2 years ago
Fix `SIM102` to handle indented `elif` (#6072) <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> The `SIM102` auto-fix fails if `elif` is indented like this: ## Example ```python def f(): # SIM102 if a: pass elif b: if c: d ``` ``` > cargo run -p ruff_cli -- check --select SIM102 --fix a.py ... error: Failed to fix nested if: Failed to extract statement from source a.py:5:5: SIM102 Use a single `if` statement instead of nested `if` statements Found 1 error. ``` ## Test Plan <!-- How was it tested? --> New test
Author
Parents
Loading