From fc93ad49781a2dd85528cdfacc5544a1bbc50ac1 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:06:12 +0100 Subject: [PATCH] Add details about typed ConfigEntry in runtime-data and strict-typing IQS rule (#2479) --- .../integration-quality-scale/rules/runtime-data.md | 7 ++++++- .../rules/strict-typing.md | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/core/integration-quality-scale/rules/runtime-data.md b/docs/core/integration-quality-scale/rules/runtime-data.md index a6770e9e..b1f48d0c 100644 --- a/docs/core/integration-quality-scale/rules/runtime-data.md +++ b/docs/core/integration-quality-scale/rules/runtime-data.md @@ -1,6 +1,7 @@ --- title: "Use ConfigEntry.runtime_data to store runtime data" related_rules: + - strict-typing - test-before-setup --- import RelatedRules from './_includes/related_rules.jsx' @@ -35,6 +36,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: MyIntegrationConfigEntry return True ``` +:::info +If the integration implements `strict-typing`, the use of a custom typed `MyIntegrationConfigEntry` is required and must be used throughout. +::: + ## Additional resources More information about configuration entries and their lifecycle can be found in the [config entry documentation](/docs/config_entries_index). @@ -45,4 +50,4 @@ There are no exceptions to this rule. ## Related rules - \ No newline at end of file + diff --git a/docs/core/integration-quality-scale/rules/strict-typing.md b/docs/core/integration-quality-scale/rules/strict-typing.md index b23f8d73..e48d0cf8 100644 --- a/docs/core/integration-quality-scale/rules/strict-typing.md +++ b/docs/core/integration-quality-scale/rules/strict-typing.md @@ -1,6 +1,9 @@ --- title: "Strict typing" +related_rules: + - runtime-data --- +import RelatedRules from './_includes/related_rules.jsx' ## Reasoning @@ -15,10 +18,18 @@ This file tells mypy that your library is fully typed, after which it can read t In the Home Assistant codebase, you can add your integration to the [`.strict-typing`](https://github.com/home-assistant/core/blob/dev/.strict-typing) file, which will enable strict type checks for your integration. +:::warning +If the integration implements `runtime-data`, the use of a custom typed `MyIntegrationConfigEntry` is required and must be used throughout. +::: + ## Additional resources To read more about the `py.typed` file, see [PEP-561](https://peps.python.org/pep-0561/). ## Exceptions -There are no exceptions to this rule. \ No newline at end of file +There are no exceptions to this rule. + +## Related rules + +