ruff
a802d7a0 - [`fastapi`] Handle ellipsis defaults in FAST002 autofix (`FAST002`) (#20810)

Commit
50 days ago
[`fastapi`] Handle ellipsis defaults in FAST002 autofix (`FAST002`) (#20810) ## Summary Implement handling of ellipsis (`...`) defaults in the `FAST002` autofix to correctly differentiate between required and optional parameters in FastAPI route definitions. Previously, the autofix did not properly handle cases where parameters used `...` as a default value (to indicate required parameters). This could lead to incorrect transformations when applying the autofix. This change updates the `FAST002` autofix logic to: - Correctly recognize `...` as a valid FastAPI required default. - Preserve the semantics of required parameters while still applying other autofix improvements. - Avoid incorrectly substituting or removing ellipsis defaults. Fixes https://github.com/astral-sh/ruff/issues/20800 ## Test Plan Added a new test fixture at: ```crates/ruff_linter/resources/test/fixtures/fastapi/FAST002_2.py```
Parents
Loading