From 996132f3f89b76f86acf1961dcb2820d93e99f0d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 16 May 2024 17:33:23 +0200 Subject: [PATCH] Ensure gold and platinum integrations implement diagnostic (#117565) --- script/hassfest/manifest.py | 47 ++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/script/hassfest/manifest.py b/script/hassfest/manifest.py index 0c7f48b9af3..53baf0d4a17 100644 --- a/script/hassfest/manifest.py +++ b/script/hassfest/manifest.py @@ -113,6 +113,27 @@ NO_IOT_CLASS = [ "websocket_api", "zone", ] +# Grandfather rule for older integrations +# https://github.com/home-assistant/developers.home-assistant/pull/1512 +NO_DIAGNOSTICS = [ + "dlna_dms", + "fronius", + "gdacs", + "geonetnz_quakes", + "google_assistant_sdk", + "hyperion", + "modbus", + "nightscout", + "nws", + "point", + "pvpc_hourly_pricing", + "risco", + "smarttub", + "songpal", + "tellduslive", + "vizio", + "yeelight", +] def documentation_url(value: str) -> str: @@ -348,14 +369,28 @@ def validate_manifest(integration: Integration, core_components_dir: Path) -> No "Virtual integration points to non-existing supported_by integration", ) - if ( - (quality_scale := integration.manifest.get("quality_scale")) - and QualityScale[quality_scale.upper()] > QualityScale.SILVER - and not integration.manifest.get("codeowners") - ): + if (quality_scale := integration.manifest.get("quality_scale")) and QualityScale[ + quality_scale.upper() + ] > QualityScale.SILVER: + if not integration.manifest.get("codeowners"): + integration.add_error( + "manifest", + f"{quality_scale} integration does not have a code owner", + ) + if ( + domain not in NO_DIAGNOSTICS + and not (integration.path / "diagnostics.py").exists() + ): + integration.add_error( + "manifest", + f"{quality_scale} integration does not implement diagnostics", + ) + + if domain in NO_DIAGNOSTICS and (integration.path / "diagnostics.py").exists(): integration.add_error( "manifest", - f"{quality_scale} integration does not have a code owner", + "Implements diagnostics and can be " + "removed from NO_DIAGNOSTICS in script/hassfest/manifest.py", ) if not integration.core: