From 6202a49a93b5ccb4ceae1053068221bb571a47eb Mon Sep 17 00:00:00 2001 From: bbhtt Date: Wed, 3 Jul 2024 21:46:12 +0530 Subject: [PATCH] Promote finish-args-contains-both-x11-and-wayland to error See https://github.com/flathub-infra/flatpak-builder-lint/issues/414 --- flatpak_builder_lint/checks/finish_args.py | 2 +- tests/manifests/display-supported1.json | 7 ------- tests/manifests/finish_args-wayland-x11.json | 7 +++++++ tests/test_manifest.py | 9 +++++++-- 4 files changed, 15 insertions(+), 10 deletions(-) delete mode 100644 tests/manifests/display-supported1.json create mode 100644 tests/manifests/finish_args-wayland-x11.json diff --git a/flatpak_builder_lint/checks/finish_args.py b/flatpak_builder_lint/checks/finish_args.py index c12f7dc1..a794de17 100644 --- a/flatpak_builder_lint/checks/finish_args.py +++ b/flatpak_builder_lint/checks/finish_args.py @@ -13,7 +13,7 @@ def _validate(self, appid: Optional[str], finish_args: dict[str, Set[str]]) -> N self.warnings.add("finish-args-contains-both-x11-and-fallback") if "x11" in finish_args["socket"] and "wayland" in finish_args["socket"]: - self.warnings.add("finish-args-contains-both-x11-and-wayland") + self.errors.add("finish-args-contains-both-x11-and-wayland") if "x11" in finish_args["socket"] or "fallback-x11" in finish_args["socket"]: if "ipc" not in finish_args["share"]: diff --git a/tests/manifests/display-supported1.json b/tests/manifests/display-supported1.json deleted file mode 100644 index 68b60159..00000000 --- a/tests/manifests/display-supported1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "app-id": "org.flathub.display_supported", - "finish-args": [ - "--socket=x11", - "--socket=wayland" - ] -} diff --git a/tests/manifests/finish_args-wayland-x11.json b/tests/manifests/finish_args-wayland-x11.json new file mode 100644 index 00000000..d86201e8 --- /dev/null +++ b/tests/manifests/finish_args-wayland-x11.json @@ -0,0 +1,7 @@ +{ + "app-id": "org.flathub.finish_args", + "finish-args": [ + "--socket=wayland", + "--socket=x11" + ] +} diff --git a/tests/test_manifest.py b/tests/test_manifest.py index 88eb8727..8dc7b762 100644 --- a/tests/test_manifest.py +++ b/tests/test_manifest.py @@ -155,7 +155,6 @@ def test_manifest_finish_args() -> None: } warnings = { - "finish-args-contains-both-x11-and-wayland", "finish-args-x11-without-ipc", "finish-args-redundant-device-all", "finish-args-contains-both-x11-and-fallback", @@ -177,6 +176,12 @@ def test_manifest_finish_args() -> None: assert a not in found_errors +def test_manifest_finish_args_issue_wayland_x11() -> None: + ret = run_checks("tests/manifests/finish_args-wayland-x11.json") + found_errors = set(ret["errors"]) + assert "finish-args-contains-both-x11-and-wayland" in found_errors + + def test_manifest_finish_args_issue_33() -> None: ret = run_checks("tests/manifests/own_name_substring.json") found_errors = set(ret["errors"]) @@ -219,10 +224,10 @@ def test_manifest_display_stuff() -> None: absents = { "finish-args-fallback-x11-without-wayland", "finish-args-only-wayland", + "finish-args-contains-both-x11-and-wayland", } for file in ( - "display-supported1.json", "display-supported2.json", "display-supported3.json", ):