Skip to content

Commit

Permalink
toplevel: Show toplevel-unnecessary-branch only if branch != stable,beta
Browse files Browse the repository at this point in the history
If branch: stable or default-branch: stable is set this is harmless
and matches the expect ref branch Flathub sets, so there is no point
in erroring on this.

Instead error if unexpected branch names are set.

No error is shown if the properties are missing
  • Loading branch information
bbhtt committed Aug 23, 2024
1 parent 6a56bca commit 3d407b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion flatpak_builder_lint/checks/toplevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def check_manifest(self, manifest: dict) -> None:

branch = manifest.get("branch")
def_branch = manifest.get("default-branch")
if branch in ("stable", "master") or def_branch in ("stable", "master"):

if branch not in ("stable", "beta", None) or def_branch not in (
"stable",
"beta",
None,
):
self.errors.add("toplevel-unnecessary-branch")
self.info.add(
"toplevel-unnecessary-branch: Please remove the toplevel"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def test_manifest_toplevel() -> None:
"toplevel-no-command",
"toplevel-cleanup-debug",
"toplevel-no-modules",
"toplevel-unnecessary-branch",
}

not_founds = {
Expand All @@ -101,6 +100,7 @@ def test_manifest_toplevel() -> None:
found_errors = set(ret["errors"])

assert errors.issubset(found_errors)
assert "toplevel-unnecessary-branch" not in found_errors

ret = run_checks("tests/manifests/base_app.json")
found_errors = set(ret["errors"])
Expand Down

0 comments on commit 3d407b0

Please sign in to comment.