Skip to content

Commit

Permalink
Check for missing developer name
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee authored and barthalion committed Oct 17, 2023
1 parent da33369 commit 39b9a73
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions flatpak_builder_lint/appstream.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import subprocess

from lxml import etree # type: ignore


def validate(path: str) -> dict:
if not os.path.isfile(path):
Expand All @@ -17,3 +19,15 @@ def validate(path: str) -> dict:
}

return ret


def is_developer_name_present(path: str) -> bool:
if not os.path.isfile(path):
raise FileNotFoundError("AppStream file not found")

root = etree.parse(path)
components = root.xpath("/components/component")

developer = components[0].xpath("developer_name")

return bool(developer)
3 changes: 3 additions & 0 deletions flatpak_builder_lint/checks/metainfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def _validate(self, path: str, appid: str, flathub_json: Optional[dict]) -> None
if appinfo_validation["returncode"] != 0:
self.errors.add("appstream-failed-validation")

if not appstream.is_developer_name_present(appstream_path):
self.errors.add("appstream-missing-developer-name")

if not flathub_json.get("skip-icons-check"):
if not os.path.exists(icon_path):
self.errors.add("appstream-missing-icon-file")
Expand Down

0 comments on commit 39b9a73

Please sign in to comment.