mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
Tooling: requirements_test.txt becomes the single source of backend CI dependencies; pyproject.toml configures ruff (E/F/B/I, E501 excluded by decision) and mypy strict for a grow-only allowlist of six pure modules (junction_limits annotated to pass). The 42 substantive ruff findings are fixed — the B023 loop-variable closures bind their variables as parameter defaults instead of hiding behind noqa, and every remaining noqa carries a reason (guarded by a test). Errors: const.ERROR_CODES / ERROR_CODE_FAMILIES formalise the stable contract; the scanner test proves every emitted code across BOTH paths (send_error literals; class attrs, literal and variable-passed MarkerControlError codes, f-string families) is registered and has a localized message — 22 missing backup.error.* keys added in all four languages. invalid_passage_fields / invalid_partition_opening_jamb_margin ship structured JSON details (legacy format read-compat for one beta), and _errText renders code-first: unknown codes localize, raw English messages go to the console. CI: the backend job lints with ruff, refuses a silently skipped HA harness (import + collect threshold), measures branch coverage over pure+harness, fails below the committed baseline and uploads coverage.xml. quality_scale: docs-troubleshooting/examples honestly done, test-coverage/strict-typing carry staged progress. User-Visible: yes Issue: #42
40 lines
1.3 KiB
Python
Executable File
40 lines
1.3 KiB
Python
Executable File
"""Config flow: a single entry with no parameters."""
|
|
from __future__ import annotations
|
|
|
|
import voluptuous as vol
|
|
from homeassistant import config_entries
|
|
|
|
from .const import CONF_ADMIN_ONLY, DOMAIN
|
|
|
|
|
|
class HouseplanConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|
"""One-step setup."""
|
|
|
|
VERSION = 1
|
|
|
|
async def async_step_user(self, user_input=None):
|
|
if user_input is not None:
|
|
return self.async_create_entry(title="House Plan", data={}, options=user_input)
|
|
return self.async_show_form(
|
|
step_id="user",
|
|
data_schema=vol.Schema({vol.Optional(CONF_ADMIN_ONLY, default=True): bool}),
|
|
)
|
|
|
|
@staticmethod
|
|
def async_get_options_flow(config_entry):
|
|
return HouseplanOptionsFlow()
|
|
|
|
|
|
class HouseplanOptionsFlow(config_entries.OptionsFlow):
|
|
"""Option: layout editing by administrators only."""
|
|
|
|
async def async_step_init(self, user_input=None):
|
|
if user_input is not None:
|
|
return self.async_create_entry(title="", data=user_input)
|
|
# Match auth.may_write: missing key ⇒ admin-only (audit P0-4).
|
|
current = self.config_entry.options.get(CONF_ADMIN_ONLY, True)
|
|
return self.async_show_form(
|
|
step_id="init",
|
|
data_schema=vol.Schema({vol.Optional(CONF_ADMIN_ONLY, default=current): bool}),
|
|
)
|