From e02e5fb9cbb6a67de7f5006774614c52c566860a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Dec 2023 19:00:53 +0100 Subject: [PATCH 1/2] Improve linter to also check notworking apps and graveyard entries --- catalog_linter.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/catalog_linter.py b/catalog_linter.py index 3c5453e..3657180 100755 --- a/catalog_linter.py +++ b/catalog_linter.py @@ -37,6 +37,12 @@ def get_wishlist() -> Dict[str, Dict[str, str]]: return toml.load(wishlist_path) +@cache +def get_graveyard() -> Dict[str, Dict[str, str]]: + wishlist_path = APPS_ROOT / "graveyard.toml" + return toml.load(wishlist_path) + + def validate_schema() -> Generator[str, None, None]: with open(APPS_ROOT / "schemas" / "apps.toml.schema.json", encoding="utf-8") as file: apps_catalog_schema = json.load(file) @@ -50,9 +56,6 @@ def check_app(app: str, infos: Dict[str, Any]) -> Generator[Tuple[str, bool], No yield "state is missing", True return - if infos["state"] != "working": - return - # validate that the app is not (anymore?) in the wishlist # we use fuzzy matching because the id in catalog may not be the same exact id as in the wishlist # some entries are ignore-hard-coded, because e.g. radarr an readarr are really different apps... @@ -66,6 +69,14 @@ def check_app(app: str, infos: Dict[str, Any]) -> Generator[Tuple[str, bool], No if wishlist_matches: yield f"app seems to be listed in wishlist: {wishlist_matches}", True + graveyard_matches = [ + grave + for grave in get_graveyard() + if SequenceMatcher(None, app, grave).ratio() > 0.9 + ] + if graveyard_matches: + yield f"app seems to be listed in graveyard: {graveyard_matches}", True + repo_name = infos.get("url", "").split("/")[-1] if repo_name != f"{app}_ynh": yield f"repo name should be {app}_ynh, not in {repo_name}", True From f73a2c183cd0c8ed5f8c58de9d7f3b8e8f35cf16 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Dec 2023 19:03:23 +0100 Subject: [PATCH 2/2] Fix false positive mailman<->mailman3 --- catalog_linter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/catalog_linter.py b/catalog_linter.py index 3657180..4c383a9 100755 --- a/catalog_linter.py +++ b/catalog_linter.py @@ -69,10 +69,12 @@ def check_app(app: str, infos: Dict[str, Any]) -> Generator[Tuple[str, bool], No if wishlist_matches: yield f"app seems to be listed in wishlist: {wishlist_matches}", True + ignored_graveyard_entries = ["mailman"] graveyard_matches = [ grave for grave in get_graveyard() - if SequenceMatcher(None, app, grave).ratio() > 0.9 + if grave not in ignored_graveyard_entries + and SequenceMatcher(None, app, grave).ratio() > 0.9 ] if graveyard_matches: yield f"app seems to be listed in graveyard: {graveyard_matches}", True