mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 02:24:51 -05:00
Skip hassfest MDI icon generation on an outdated frontend (#179781)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
e149a59c2d
commit
d6e083bf07
@@ -8,6 +8,7 @@ from .model import Config, Integration
|
||||
from .serializer import format_python_namespace
|
||||
|
||||
_TARGET = "pylint/plugins/pylint_home_assistant/generated/mdi_icons.py"
|
||||
_REQUIREMENT_PREFIX = "home-assistant-frontend=="
|
||||
|
||||
|
||||
def _get_frontend_version() -> str | None:
|
||||
@@ -18,6 +19,14 @@ def _get_frontend_version() -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
def _get_pinned_frontend_version(integrations: dict[str, Integration]) -> str | None:
|
||||
"""Get the home-assistant-frontend version pinned in the frontend manifest."""
|
||||
for requirement in integrations["frontend"].requirements:
|
||||
if requirement.startswith(_REQUIREMENT_PREFIX):
|
||||
return requirement.removeprefix(_REQUIREMENT_PREFIX)
|
||||
return None
|
||||
|
||||
|
||||
def _load_mdi_icons() -> set[str]:
|
||||
"""Load the MDI icon names from the frontend package."""
|
||||
try:
|
||||
@@ -35,6 +44,10 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
if frontend_version is None:
|
||||
return
|
||||
|
||||
pinned_version = _get_pinned_frontend_version(integrations)
|
||||
if pinned_version is not None and pinned_version != frontend_version:
|
||||
return
|
||||
|
||||
icons = _load_mdi_icons()
|
||||
if not icons:
|
||||
config.add_error(
|
||||
|
||||
Reference in New Issue
Block a user