Adds [tool.ruff] and [tool.ty] config to pyproject.toml with a curated ruff rule set (E, F, W, I, UP, B, C4, SIM, RUF, ASYNC, LOG, G, PIE, RET, PERF, N), pins ruff/ty in requirements-dev.txt, reformats the whole tree with `ruff format`, and fixes the pre-existing lint and type-check debt those tools surfaced so both run clean. Production-code type fixes include: HA's ConfigFlowResult vs. the generic FlowResult in config_flow.py, narrowing BoundEntity.desc to its platform-specific subclass (SelectDesc/NumberDesc/SensorDesc/etc.) via cast() instead of an unchecked annotation, converting HA device_class strings to their proper enum types, a resolve_registry callback typed as `object` instead of `DeviceRegistry | None`, and a couple of other narrow correctness fixes (CA key type validation, an index-out-of-bounds false positive from an empty-tuple fallback, a bool/dict argument swap). Test-file fixes are mechanical: narrowing SamsungEntityDescription to the correct subclass via isinstance()/cast() before accessing subclass-only fields, and asserting Optional write_fn/unit_fn fields are set before calling them.
39 lines
842 B
TOML
39 lines
842 B
TOML
[project]
|
|
requires-python = ">=3.13"
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
|
|
[tool.ruff]
|
|
target-version = "py313"
|
|
line-length = 100
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"F", # pyflakes
|
|
"W", # pycodestyle warnings
|
|
"I", # isort
|
|
"UP", # pyupgrade
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"SIM", # flake8-simplify
|
|
"RUF", # ruff-specific
|
|
"ASYNC", # flake8-async
|
|
"LOG", # flake8-logging
|
|
"G", # flake8-logging-format
|
|
"PIE", # flake8-pie
|
|
"RET", # flake8-return
|
|
"PERF", # perflint
|
|
"N", # pep8-naming
|
|
]
|
|
ignore = [
|
|
"N818", # exception name doesn't need an Error suffix in this codebase
|
|
]
|
|
|
|
[tool.ruff.lint.isort]
|
|
known-first-party = ["custom_components"]
|
|
|
|
[tool.ty.environment]
|
|
python-version = "3.13"
|