ruff/crates/ruff_python_ast
Robsdedude 6802c4702f
[`flake8-pyi`] Expand `Optional[A]` to `A | None` (`PYI016`) (#18572)
## Summary
Under preview 🧪 I've expanded rule `PYI016` to also flag type
union duplicates containing `None` and `Optional`.

## Test Plan
Examples/tests have been added. I've made sure that the existing
examples did not change unless preview is enabled.

## Relevant Issues
* https://github.com/astral-sh/ruff/issues/18508 (discussing
introducing/extending a rule to flag `Optional[None]`)
* https://github.com/astral-sh/ruff/issues/18546 (where I discussed this
addition with @AlexWaygood)

---------

Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
2025-06-27 15:43:11 +00:00
..
src [`flake8-pyi`] Expand `Optional[A]` to `A | None` (`PYI016`) (#18572) 2025-06-27 15:43:11 +00:00
Cargo.toml [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00
ast.toml Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
generate.py [ty] Add environment variable to dump Salsa memory usage stats (#18928) 2025-06-26 21:27:51 +00:00