mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
Three claims a green backend used to make, each slightly wider than the truth — and #392 happened in exactly that gap. The frontend pin said 20260826.1 next to homeassistant==2026.8.3, whose package_constraints.txt requires 20260729.7: a combination that exists in no HA release. It was never derived from anything — someone once picked it. It is now taken from the constraints, the source is named in the file, and a test holds both numbers together so raising HA cannot quietly desync them. ruff's include declared three trees while CI linted one. Narrowed the declaration rather than widening CI: the debt in scripts/ and tests_backend/ (56 findings, mostly E402/I001, plus 7 B023 and 5 B017) has its own cost and its own decisions, and belongs in its own task, not in a visibility fix. test/lint-scope.test.mjs now compares the two, so they can only move together. The pin check skipped a workflow when it found neither the package name nor the requirements path — and both vanish together the moment someone returns to Defaulting to user installation because normal site-packages is not writeable, i.e. the gate switched itself off under precisely the change it exists to catch. It now walks the whole .github/workflows directory and decides per file by a positive sign: if a file installs python packages, it must install them from the pins file. Verified by dropping a rogue workflow into the directory — it reddens without touching any list. Three mutants registered and each run by hand. User-Visible: no Issue: #399
47 lines
2.4 KiB
TOML
47 lines
2.4 KiB
TOML
# #42: tool configuration only — the integration itself ships via HACS, not pip.
|
|
|
|
[tool.ruff]
|
|
target-version = "py313"
|
|
# Скоуп ОБЪЯВЛЕННЫЙ равен проверяемому (#399). Раньше здесь стояли три
|
|
# дерева, а CI линтил одно — читающий конфиг делал неверный вывод, и в
|
|
# tests_backend уже проехали F401/F811, которых на v1.69.0 не было.
|
|
#
|
|
# Сужение, а не расширение: разбор долга в scripts/ и tests_backend/ (56
|
|
# находок, в основном E402 и I001 в тестах, плюс 7 B023 и 5 B017) — работа
|
|
# со своей ценой и своими решениями, её место в отдельной задаче, а не в
|
|
# правке видимости. Расширять этот список можно только вместе со шагом
|
|
# «Линт бэкенда» в validate.yml — за этим следит test/lint-scope.test.mjs.
|
|
include = ["custom_components/houseplan/**/*.py"]
|
|
|
|
[tool.ruff.lint]
|
|
# Narrow on purpose (#42: no mass rewrite): errors, pyflakes, bugbear, imports.
|
|
select = ["E", "F", "B", "I"]
|
|
# E501: 291 legacy long lines are NOT rewritten wholesale; length is not a gate.
|
|
ignore = ["E501"]
|
|
|
|
[tool.mypy]
|
|
# 3.14, как и раннер после #392: mypy разбирает исходники установленного
|
|
# homeassistant, а тот уже написан на синтаксисе 3.14 (`except` без скобок) —
|
|
# на более низком python_version проверка падает синтаксической ошибкой в
|
|
# чужом файле, не дойдя до наших модулей.
|
|
python_version = "3.14"
|
|
explicit_package_bases = true
|
|
mypy_path = "."
|
|
# Strict is opt-in per module (#42): the allowlist below only ever GROWS —
|
|
# test/config-schema-parity guards live elsewhere; the backend guard is
|
|
# tests_backend/test_backend_quality.py which fails when a module leaves.
|
|
ignore_missing_imports = true
|
|
follow_imports = "silent"
|
|
no_site_packages = false
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = [
|
|
"custom_components.houseplan.const",
|
|
"custom_components.houseplan.projection",
|
|
"custom_components.houseplan.coordinate_canonicalization",
|
|
"custom_components.houseplan.frontend_asset_manifest",
|
|
"custom_components.houseplan.junction_limits",
|
|
"custom_components.houseplan.plans",
|
|
]
|
|
strict = true
|