diff --git a/catalog_linter.py b/catalog_linter.py index 3c5453e..4c383a9 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,16 @@ 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 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 + 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