Add tag to base platforms
This commit is contained in:
parent
907086edbc
commit
381bcf12f0
2 changed files with 3 additions and 4 deletions
|
@ -71,6 +71,7 @@ class Platform(StrEnum):
|
||||||
SIREN = "siren"
|
SIREN = "siren"
|
||||||
STT = "stt"
|
STT = "stt"
|
||||||
SWITCH = "switch"
|
SWITCH = "switch"
|
||||||
|
TAG = "tag"
|
||||||
TEXT = "text"
|
TEXT = "text"
|
||||||
TIME = "time"
|
TIME = "time"
|
||||||
TODO = "todo"
|
TODO = "todo"
|
||||||
|
|
|
@ -8,7 +8,7 @@ from astroid import nodes
|
||||||
from pylint.checkers import BaseChecker
|
from pylint.checkers import BaseChecker
|
||||||
from pylint.lint import PyLinter
|
from pylint.lint import PyLinter
|
||||||
|
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import BASE_PLATFORMS
|
||||||
|
|
||||||
_MODULES: dict[str, set[str]] = {
|
_MODULES: dict[str, set[str]] = {
|
||||||
"air_quality": {"AirQualityEntity"},
|
"air_quality": {"AirQualityEntity"},
|
||||||
|
@ -65,8 +65,6 @@ _MODULES: dict[str, set[str]] = {
|
||||||
"WeatherEntityDescription",
|
"WeatherEntityDescription",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_ENTITY_COMPONENTS: set[str] = {platform.value for platform in Platform}
|
|
||||||
_ENTITY_COMPONENTS.add("tag")
|
|
||||||
|
|
||||||
|
|
||||||
class HassEnforceClassModule(BaseChecker):
|
class HassEnforceClassModule(BaseChecker):
|
||||||
|
@ -93,7 +91,7 @@ class HassEnforceClassModule(BaseChecker):
|
||||||
current_integration = parts[2]
|
current_integration = parts[2]
|
||||||
current_module = parts[3] if len(parts) > 3 else ""
|
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))
|
top_level_ancestors = list(node.ancestors(recurs=False))
|
||||||
|
|
||||||
for ancestor in top_level_ancestors:
|
for ancestor in top_level_ancestors:
|
||||||
|
|
Loading…
Add table
Reference in a new issue