Enable RUF013 to enforce optional typing (#37266)

* Enable RUF013 for Optional typing

Signed-off-by: cyy <cyyever@outlook.com>

* Add Optional to types

* Format code

Signed-off-by: cyy <cyyever@outlook.com>

---------

Signed-off-by: cyy <cyyever@outlook.com>
This commit is contained in:
Yuanyuan Chen
2025-05-08 18:39:56 +08:00
committed by GitHub
parent f6664ee713
commit 06c16de3d3
11 changed files with 41 additions and 32 deletions

View File

@@ -20,7 +20,9 @@ line-length = 119
[tool.ruff.lint]
# Never enforce `E501` (line length violations).
ignore = ["C901", "E501", "E741", "F402", "F823" ]
select = ["C", "E", "F", "I", "W"]
# RUF013: Checks for the use of implicit Optional
# in type annotations when the default parameter value is None.
select = ["C", "E", "F", "I", "W", "RUF013"]
# Ignore import violations in all `__init__.py` files.
[tool.ruff.lint.per-file-ignores]