Skip to content

Commit

Permalink
Add checks for conflicting mapping options (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Nov 10, 2023
1 parent 2c8dad9 commit 26ca0dd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down

0 comments on commit 26ca0dd

Please sign in to comment.