Adopt shared ruff rule set (B, N, UP, SIM, C4) and fix findings #3

Merged
tim merged 1 commit from chore/ruff-rule-set into main 2026-10-12 13:14:30 +00:00
Owner

Rule set from workflow-basics templates/ruff.toml (workflow-basics MR #7). 13 findings, all fixed, no suppressions.

Bugs (each with a test that fails on main, 5 of 7 new tests fail there):

  • water_heater.target_temperature: if "DomesticHotWaterTemperatureHeating": was always true. KeyError on units without that key, TargetTemperature never used.
  • water_heater.async_toggle: called the current_operation property (TypeError).
  • sensor.ConsumptionSensor.extra_state_attributes: month loop was dedented out of its if, so unknown content names raised UnboundLocalError and "Day" ran the loop twice.

Lint: get_HWT_device_info/HWT_device_info renamed to snake case (internal API), asyncio.TimeoutError to TimeoutError, f-string, zip(strict=True) (key list is built from the content length), tuple default for states, simplified conditionals.

Verified on python 3.14, homeassistant 2026.10.1, pyaltherma v0.1.1: ruff check, ruff format, bandit, 16 tests pass.

Merge after workflow-basics #7 is not required (ruff.toml is a copy).

🤖 Generated with Claude Code

https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98

Rule set from workflow-basics `templates/ruff.toml` (workflow-basics MR #7). 13 findings, all fixed, no suppressions. Bugs (each with a test that fails on main, 5 of 7 new tests fail there): - `water_heater.target_temperature`: `if "DomesticHotWaterTemperatureHeating":` was always true. KeyError on units without that key, `TargetTemperature` never used. - `water_heater.async_toggle`: called the `current_operation` property (TypeError). - `sensor.ConsumptionSensor.extra_state_attributes`: month loop was dedented out of its `if`, so unknown content names raised UnboundLocalError and "Day" ran the loop twice. Lint: `get_HWT_device_info`/`HWT_device_info` renamed to snake case (internal API), `asyncio.TimeoutError` to `TimeoutError`, f-string, `zip(strict=True)` (key list is built from the content length), tuple default for `states`, simplified conditionals. Verified on python 3.14, homeassistant 2026.10.1, pyaltherma v0.1.1: ruff check, ruff format, bandit, 16 tests pass. Merge after workflow-basics #7 is not required (ruff.toml is a copy). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98
Adopt shared ruff rule set and fix what it and review found
All checks were successful
CI / Lint and test (pull_request) Successful in 1m24s
Hassfest / Validate integration (pull_request) Successful in 12s
Security / Security scan (pull_request) Successful in 12s
287b8506e7
Rule set: E4, E7, E9, F plus B, N, UP, SIM, C4 (workflow-basics templates/ruff.toml).

Bugs fixed:
- water_heater: target_temperature tested a constant string, so units without
  DomesticHotWaterTemperatureHeating raised KeyError and TargetTemperature
  was never used
- water_heater: async_toggle called the current_operation property
- sensor: the month attribute loop was dedented out of its if, so unknown
  content names raised UnboundLocalError and Day ran the loop twice

Lint: rename get_HWT_device_info/HWT_device_info to snake case, TimeoutError
alias, f-string, zip strict, immutable default for states, simplified
conditionals.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98
tim merged commit a04c3d81c9 into main 2026-10-12 13:14:30 +00:00
tim deleted branch chore/ruff-rule-set 2026-10-12 13:14:30 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
tim/hass-daikin-altherma!3
No description provided.