Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check on the app name unicity #89

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions scripts/app_load_params_lint.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3

import json
import difflib
from argparse import ArgumentParser
from pathlib import Path
from app_load_params_utils import format_database
from app_load_params_check import APP_LOAD_PARAMS_VALUE_CHECK
import json
import difflib


def check_database_lint(database_path: Path):
Expand All @@ -15,7 +15,7 @@ def check_database_lint(database_path: Path):
database = json.loads(database_str)

for variant, params in database.items():
for param, value in params.items():
for param, _ in params.items():
if param not in APP_LOAD_PARAMS_VALUE_CHECK:
print(f"[ERROR] Not allowed '{param}' in variant '{variant}'")
ret = -1
Expand All @@ -40,13 +40,14 @@ def check_database_appnames(database_path: Path):
database_str = f.read()
database = json.loads(database_str)

db_rev = {v["appName"]: k for k, v in database.items()}
db_rev = {v["appName"].lower().replace(" ","").replace("_", "").replace("-", ""): k for k,
v in database.items()}

for variant, params in database.items():
app_name = params["appName"]
db_rev_variant = db_rev[app_name]
db_rev_variant = db_rev[app_name.lower().replace(" ","").replace("_", "").replace("-", "")]
if db_rev_variant != variant:
print(f"[ERROR] Conflict on appName between '{db_rev_variant}' and '{variant}'")
print(f"[ERROR] Conflict on appName between '{db_rev_variant}' and '{variant}'. AppName shall be unique ('-',' ' and '_' are stripped)")
ret = -1

if ret != 0:
Expand Down