mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Implement new Integration Quality Scale (#130518)
This commit is contained in:
parent
e6225e3dcc
commit
ae0cd431a0
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from enum import IntEnum
|
from enum import IntEnum, StrEnum, auto
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -28,16 +28,29 @@ DOCUMENTATION_URL_PATH_PREFIX = "/integrations/"
|
|||||||
DOCUMENTATION_URL_EXCEPTIONS = {"https://www.home-assistant.io/hassio"}
|
DOCUMENTATION_URL_EXCEPTIONS = {"https://www.home-assistant.io/hassio"}
|
||||||
|
|
||||||
|
|
||||||
class QualityScale(IntEnum):
|
class ScaledQualityScaleTiers(IntEnum):
|
||||||
"""Supported manifest quality scales."""
|
"""Supported manifest quality scales."""
|
||||||
|
|
||||||
INTERNAL = -1
|
BRONZE = 1
|
||||||
SILVER = 1
|
SILVER = 2
|
||||||
GOLD = 2
|
GOLD = 3
|
||||||
PLATINUM = 3
|
PLATINUM = 4
|
||||||
|
|
||||||
|
|
||||||
SUPPORTED_QUALITY_SCALES = [enum.name.lower() for enum in QualityScale]
|
class NonScaledQualityScaleTiers(StrEnum):
|
||||||
|
"""Supported manifest quality scales."""
|
||||||
|
|
||||||
|
CUSTOM = auto()
|
||||||
|
NO_SCORE = auto()
|
||||||
|
INTERNAL = auto()
|
||||||
|
LEGACY = auto()
|
||||||
|
|
||||||
|
|
||||||
|
SUPPORTED_QUALITY_SCALES = [
|
||||||
|
value.name.lower()
|
||||||
|
for enum in [ScaledQualityScaleTiers, NonScaledQualityScaleTiers]
|
||||||
|
for value in enum
|
||||||
|
]
|
||||||
SUPPORTED_IOT_CLASSES = [
|
SUPPORTED_IOT_CLASSES = [
|
||||||
"assumed_state",
|
"assumed_state",
|
||||||
"calculated",
|
"calculated",
|
||||||
@ -346,9 +359,12 @@ def validate_manifest(integration: Integration, core_components_dir: Path) -> No
|
|||||||
"Virtual integration points to non-existing supported_by integration",
|
"Virtual integration points to non-existing supported_by integration",
|
||||||
)
|
)
|
||||||
|
|
||||||
if (quality_scale := integration.manifest.get("quality_scale")) and QualityScale[
|
if (
|
||||||
quality_scale.upper()
|
(quality_scale := integration.manifest.get("quality_scale"))
|
||||||
] > QualityScale.SILVER:
|
and quality_scale.upper() in ScaledQualityScaleTiers
|
||||||
|
and ScaledQualityScaleTiers[quality_scale.upper()]
|
||||||
|
>= ScaledQualityScaleTiers.SILVER
|
||||||
|
):
|
||||||
if not integration.manifest.get("codeowners"):
|
if not integration.manifest.get("codeowners"):
|
||||||
integration.add_error(
|
integration.add_error(
|
||||||
"manifest",
|
"manifest",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user