Add tag to base platforms

pull/126183/head
epenet 2024-09-19 09:17:48 +00:00
parent 907086edbc
commit 381bcf12f0
2 changed files with 3 additions and 4 deletions

View File

@ -71,6 +71,7 @@ class Platform(StrEnum):
SIREN = "siren"
STT = "stt"
SWITCH = "switch"
TAG = "tag"
TEXT = "text"
TIME = "time"
TODO = "todo"

View File

@ -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: