Skip to content

Commit

Permalink
appid: Return early if incorrect code hosting domain found
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Sep 16, 2024
1 parent 62f2f23 commit c2462da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions flatpak_builder_lint/checks/appid.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ def _validate(self, appid: Optional[str], is_extension: bool) -> None:
if tld != "io" and domain in ("github", "gitlab"):
self.errors.add("appid-uses-code-hosting-domain")
self.info.add(f"appid-uses-code-hosting-domain: {domain}.{tld}")
return
if tld != "page" and domain == "codeberg":
self.errors.add("appid-uses-code-hosting-domain")
self.info.add(f"appid-uses-code-hosting-domain: {domain}.{tld}")
return
if len(split) < 4:
self.errors.add("appid-code-hosting-too-few-components")
return
Expand Down
3 changes: 3 additions & 0 deletions tests/manifests/appid-too-few-cpts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app-id": "io.github.foo"
}
10 changes: 9 additions & 1 deletion tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,22 @@ def test_manifest_toplevel() -> None:
def test_manifest_appid() -> None:
errors = {
"appid-filename-mismatch",
"appid-code-hosting-too-few-components",
"appid-uses-code-hosting-domain",
}
ret = run_checks("tests/manifests/appid.json")
found_errors = set(ret["errors"])
assert errors.issubset(found_errors)


def test_manifest_appid() -> None:
errors = {
"appid-code-hosting-too-few-components",
}
ret = run_checks("tests/manifests/appid-too-few-cpts.json")
found_errors = set(ret["errors"])
assert errors.issubset(found_errors)


def test_manifest_flathub_json() -> None:
errors = {
"flathub-json-skip-appstream-check",
Expand Down

0 comments on commit c2462da

Please sign in to comment.