From 1ce0ed4ec455aca4d5fc11224ae847c7c449fd5c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:39:50 +0000 Subject: [PATCH] Support for kwargs --- pylint/plugins/hass_enforce_constants.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pylint/plugins/hass_enforce_constants.py b/pylint/plugins/hass_enforce_constants.py index 66a25a3d793..67b438ce641 100644 --- a/pylint/plugins/hass_enforce_constants.py +++ b/pylint/plugins/hass_enforce_constants.py @@ -33,10 +33,15 @@ class HassEnforceConstantsChecker(BaseChecker): if isinstance(node.func, nodes.Name): if node.func.name == "async_setup_component": - self._ensure_domain_argument(node, node.args[1]) + if len(node.args) >= 2: + self._ensure_domain_argument(node, node.args[1]) + else: + for keyword in node.keywords: + if keyword.arg == "domain": + self._ensure_domain_argument(node, keyword.value) def _ensure_domain_argument( - self, call_node: nodes.Call, arg_node: nodes.Argument + self, call_node: nodes.Call, arg_node: nodes.Argument | nodes.Keyword ) -> None: if isinstance(arg_node, nodes.Attribute) and arg_node.attrname.endswith( "DOMAIN"