1
0
Fork 0

Improve linter to also check notworking apps and graveyard entries

This commit is contained in:
Alexandre Aubin 2023-12-18 19:00:53 +01:00
parent 8b7b486902
commit e02e5fb9cb

View file

@ -37,6 +37,12 @@ def get_wishlist() -> Dict[str, Dict[str, str]]:
return toml.load(wishlist_path) 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]: def validate_schema() -> Generator[str, None, None]:
with open(APPS_ROOT / "schemas" / "apps.toml.schema.json", encoding="utf-8") as file: with open(APPS_ROOT / "schemas" / "apps.toml.schema.json", encoding="utf-8") as file:
apps_catalog_schema = json.load(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 yield "state is missing", True
return return
if infos["state"] != "working":
return
# validate that the app is not (anymore?) in the wishlist # 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 # 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... # 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: if wishlist_matches:
yield f"app seems to be listed in wishlist: {wishlist_matches}", True 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] repo_name = infos.get("url", "").split("/")[-1]
if repo_name != f"{app}_ynh": if repo_name != f"{app}_ynh":
yield f"repo name should be {app}_ynh, not in {repo_name}", True yield f"repo name should be {app}_ynh, not in {repo_name}", True