From ace6d0061b5ce6ab2e87e5948958784d13701b98 Mon Sep 17 00:00:00 2001 From: Andrei Buzera Date: Mon, 26 Oct 2026 22:29:20 +0200 Subject: [PATCH] Add bug-finding lint to the checks Run ruff with pyflakes, syntax-error and bugbear rules only (no style rules) over the integration, tests and scripts as part of check.sh and CI. The codebase passes as is. Target Python 3.9 because the offline tests are also run on older interpreters, which also leaves out the zip(strict=) rule that needs 3.10. ruff 0.14.0 pinned in both test requirement files. Co-Authored-By: Claude Opus 5.5 --- requirements-test-latest.txt | 2 ++ requirements-test.txt | 2 ++ ruff.toml | 6 ++++++ scripts/check.sh | 1 + 4 files changed, 11 insertions(+) create mode 100644 ruff.toml diff --git a/requirements-test-latest.txt b/requirements-test-latest.txt index ae1c0c3..b15f804 100644 --- a/requirements-test-latest.txt +++ b/requirements-test-latest.txt @@ -1,3 +1,5 @@ # Newest published fixtures: Home Assistant 2026.2.3; requires Python 3.13. # Update together with the README's tested-versions note. pytest-homeassistant-custom-component==0.13.316 +# Bug-finding lint (see ruff.toml). +ruff==0.14.0 diff --git a/requirements-test.txt b/requirements-test.txt index 29e3dfa..26d5dce 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,3 +2,5 @@ pytest-homeassistant-custom-component==0.13.298 # aiodns 3.5 (HA's pin) uses APIs removed in pycares 5. pycares==4.11.0 +# Bug-finding lint (see ruff.toml). +ruff==0.14.0 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..4c86e83 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,6 @@ +# Bug-finding lint only (pyflakes, syntax errors, bugbear); no style rules. +# py39: the offline tests also run on older Pythons, so e.g. zip(strict=) is not available. +target-version = "py39" + +[lint] +select = ["F", "E9", "B"] diff --git a/scripts/check.sh b/scripts/check.sh index 0708bdb..2ff3315 100644 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -4,6 +4,7 @@ set -eu # A transitive HA test dependency otherwise fetches metadata on import. export LITELLM_LOCAL_MODEL_COST_MAP=True python -m pip check +python -m ruff check --no-cache . python -m unittest discover -s tests -v python -m pytest tests/ha -q python -m compileall -q custom_components/heating_mpc