Jelajahi Sumber

tests (untranslated_entities): surface the error count

revert to warnings, since it is not being marked as error that surfaces them
return the error count, as a non-zero exit code is required to trigger
error display
Jason Rumney 5 hari lalu
induk
melakukan
f48cdc90b4
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      util/untranslated_entities.py

+ 4 - 2
util/untranslated_entities.py

@@ -14,6 +14,7 @@ from custom_components.tuya_local.helpers.device_config import (
 def main() -> int:
     with open("custom_components/tuya_local/translations/en.json", "r") as f:
         english = json.load(f)
+    detected = 0
     for config in available_configs():
         device = TuyaDeviceConfig(config)
         for entity in device.all_entities():
@@ -27,9 +28,10 @@ def main() -> int:
             slug = slugify(entity.name)
             if slug in translations:
                 print(
-                    f"::error file={config},line={entity._config.__line__}:: Entity can use translation_key: {slug}"
+                    f"::warning file={config},line={entity._config.__line__}:: Entity can use translation_key: {slug}"
                 )
-    return 0
+                detected += 1
+    return detected
 
 
 if __name__ == "__main__":