mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 02:12:22 +00:00
![]() ## Summary This fixes two problems discovered when trying to format the cpython repo with `cargo run --bin ruff_dev -- check-formatter-stability projects/cpython`: The first is to ignore try/except trailing comments for now since they lead to unstable formatting on the dummy. The second is to avoid dropping trailing if comments through placement: This changes the placement to keep a comment trailing an if-elif or if-elif-else to keep the comment a trailing comment on the entire if. Previously the last comment would have been lost. ```python if "first if": pass elif "first elif": pass ``` The last remaining problem in cpython so far is function signature argument separator comment placement which is its own PR on top of this. ## Test Plan I added test fixtures of minimized examples with links back to the original cpython location |
||
---|---|---|
.. | ||
flake8_to_ruff | ||
ruff | ||
ruff_benchmark | ||
ruff_cache | ||
ruff_cli | ||
ruff_dev | ||
ruff_diagnostics | ||
ruff_formatter | ||
ruff_index | ||
ruff_macros | ||
ruff_python_ast | ||
ruff_python_formatter | ||
ruff_python_semantic | ||
ruff_python_stdlib | ||
ruff_python_whitespace | ||
ruff_rustpython | ||
ruff_testing_macros | ||
ruff_textwrap | ||
ruff_wasm |