ci: Add a proper catalog linter instead of bash mess
This commit is contained in:
parent
98b87d4f72
commit
e22aab15c1
1 changed files with 28 additions and 0 deletions
28
catalog_linter.py
Normal file
28
catalog_linter.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import toml
|
||||||
|
import sys
|
||||||
|
|
||||||
|
catalog = toml.load(open('apps.toml'))
|
||||||
|
catalog = {app: infos for app, infos in catalog.items() if infos.get('state') == "working"}
|
||||||
|
categories = toml.load(open('categories.toml')).keys()
|
||||||
|
|
||||||
|
def check_apps():
|
||||||
|
|
||||||
|
for app, infos in catalog.items():
|
||||||
|
|
||||||
|
repo_name = infos.get("url", "").split("/")[-1]
|
||||||
|
if repo_name != app + "_ynh":
|
||||||
|
yield f"{app}: repo name should be {app}_ynh, not in {repo_name}"
|
||||||
|
|
||||||
|
category = infos.get("category")
|
||||||
|
if not category:
|
||||||
|
yield f"{app}: missing category"
|
||||||
|
if category not in categories:
|
||||||
|
yield f"{app}: category {category} is not defined in categories.toml"
|
||||||
|
|
||||||
|
errors = list(check_apps())
|
||||||
|
|
||||||
|
for error in errors:
|
||||||
|
print(error)
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
sys.exit(1)
|
Loading…
Reference in a new issue