From 26ca0dd8709f99061045b845e4a6aabd91bde941 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 10 Nov 2023 21:43:19 +0100 Subject: [PATCH] Add checks for conflicting mapping options (#163) --- src/lint.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/lint.py b/src/lint.py index 880bbf5..274f8d8 100644 --- a/src/lint.py +++ b/src/lint.py @@ -133,6 +133,41 @@ def is_default(validator, properties, instance, schema): f"::warning file={config}::'map' contains the 'config' folder, which has been replaced by 'homeassistant_config'. See: https://developers.home-assistant.io/blog/2023/11/06/public-addon-config" ) +if ( + configuration.get("map") + and ( + "config" in configuration["map"] + or "config:rw" in configuration["map"] + or "config:ro" in configuration["map"] + ) + and ( + "homeassistant_config" in configuration["map"] + or "homeassistant_config:rw" in configuration["map"] + or "homeassistant_config:ro" in configuration["map"] + ) +): + print( + f"::error file={config}::'map' contains both the 'config' and 'homeassistant_config' folder, which are conflicting. See: https://developers.home-assistant.io/blog/2023/11/06/public-addon-config" + ) + exit_code = 1 + +if ( + configuration.get("map") + and ( + "config" in configuration["map"] + or "config:rw" in configuration["map"] + or "config:ro" in configuration["map"] + ) + and ( + "addon_config" in configuration["map"] + or "addon_config:rw" in configuration["map"] + or "addon_config:ro" in configuration["map"] + ) +): + print( + f"::error file={config}::'map' contains both the 'config' and 'addon_config' folder, which are conflicting. See: https://developers.home-assistant.io/blog/2023/11/06/public-addon-config" + ) + exit_code = 1 # Checks regarding build file(if found) for file_type in ("json", "yaml", "yml"):