From 381bcf12f0b52a5df665086862e715bbc7e90b79 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 19 Sep 2024 09:17:48 +0000 Subject: [PATCH] Add tag to base platforms --- homeassistant/const.py | 1 + pylint/plugins/hass_enforce_class_module.py | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index acbef5c58cc..e2fd4ed437f 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -71,6 +71,7 @@ class Platform(StrEnum): SIREN = "siren" STT = "stt" SWITCH = "switch" + TAG = "tag" TEXT = "text" TIME = "time" TODO = "todo" diff --git a/pylint/plugins/hass_enforce_class_module.py b/pylint/plugins/hass_enforce_class_module.py index c0b363bbddf..43e5145a945 100644 --- a/pylint/plugins/hass_enforce_class_module.py +++ b/pylint/plugins/hass_enforce_class_module.py @@ -8,7 +8,7 @@ from astroid import nodes from pylint.checkers import BaseChecker from pylint.lint import PyLinter -from homeassistant.const import Platform +from homeassistant.const import BASE_PLATFORMS _MODULES: dict[str, set[str]] = { "air_quality": {"AirQualityEntity"}, @@ -65,8 +65,6 @@ _MODULES: dict[str, set[str]] = { "WeatherEntityDescription", }, } -_ENTITY_COMPONENTS: set[str] = {platform.value for platform in Platform} -_ENTITY_COMPONENTS.add("tag") class HassEnforceClassModule(BaseChecker): @@ -93,7 +91,7 @@ class HassEnforceClassModule(BaseChecker): current_integration = parts[2] current_module = parts[3] if len(parts) > 3 else "" - if current_module != "entity" and current_integration not in _ENTITY_COMPONENTS: + if current_module != "entity" and current_integration not in BASE_PLATFORMS: top_level_ancestors = list(node.ancestors(recurs=False)) for ancestor in top_level_ancestors: