1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add translations check script (#34272)

This commit is contained in:
Paulus Schoutsen
2020-04-15 16:58:20 -07:00
committed by GitHub
parent d011b46985
commit 1ffc3a00e7
13 changed files with 106 additions and 40 deletions

View File

@@ -1,29 +0,0 @@
"""Validate integration JSON files."""
import json
from typing import Dict
from .model import Integration
def validate_json_files(integration: Integration):
"""Validate JSON files for integration."""
for json_file in integration.path.glob("**/*.json"):
if not json_file.is_file():
continue
try:
json.loads(json_file.read_text())
except json.JSONDecodeError:
relative_path = json_file.relative_to(integration.path)
integration.add_error("json", f"Invalid JSON file {relative_path}")
return
def validate(integrations: Dict[str, Integration], config):
"""Handle JSON files inside integrations."""
for integration in integrations.values():
if not integration.manifest:
continue
validate_json_files(integration)