From c19a8ef8e00f4a572042c51bbab11610b0120ea5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 28 Jun 2022 10:08:36 +0200 Subject: [PATCH] Enforce flow-handler result type hint for step_* (#72834) --- pylint/plugins/hass_enforce_type_hints.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 5c1a35c757a..e1517ede1ff 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -37,6 +37,8 @@ class TypeHintMatch: self.function_name == node.name or self.has_async_counterpart and node.name == f"async_{self.function_name}" + or self.function_name.endswith("*") + and node.name.startswith(self.function_name[:-1]) ) @@ -370,6 +372,16 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = { _CLASS_MATCH: dict[str, list[ClassTypeHintMatch]] = { "config_flow": [ + ClassTypeHintMatch( + base_class="FlowHandler", + matches=[ + TypeHintMatch( + function_name="async_step_*", + arg_types={}, + return_type="FlowResult", + ), + ], + ), ClassTypeHintMatch( base_class="ConfigFlow", matches=[