Skip to content

Commit

Permalink
Remove some redundant errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Aug 7, 2024
1 parent 8f0a34c commit ee08cf1
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 148 deletions.
14 changes: 0 additions & 14 deletions flatpak_builder_lint/appstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,6 @@ def is_valid_component_type(path: str) -> bool:
return False


def name(path: str) -> Optional[str]:
for name in parse_xml(path).findall("component/name"):
if not name.attrib.get(r"{http://www.w3.org/XML/1998/namespace}lang"):
return str(name.text)
return None


def summary(path: str) -> Optional[str]:
for summary in parse_xml(path).findall("component/summary"):
if not summary.attrib.get(r"{http://www.w3.org/XML/1998/namespace}lang"):
return str(summary.text)
return None


def check_caption(path: str) -> bool:
exp = "//screenshot[not(caption/text()) or not(caption)]"
return not any(e is not None for e in parse_xml(path).xpath(exp))
Expand Down
7 changes: 0 additions & 7 deletions flatpak_builder_lint/checks/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ def _validate(self, path: str, appid: str) -> None:
# https://gitlab.freedesktop.org/xdg/desktop-file-utils/-/issues/6
self.errors.add("desktop-file-exec-key-absent")
else:
if not len(exect) > 0:
# https://github.com/flatpak/flatpak/commit/298286be2d8ceacc426dedecc0e38a3f82d8aedc
# Flatpak allows exporting empty Exec key because it is
# going to be rewritten w/o command and command in
# manifest is going to be used as default. Rely on
# fallback but also warn
self.warnings.add("desktop-file-exec-key-empty")
if len(exect) > 0 and "flatpak run" in exect:
# desktop files are rewritten only on (re)install, neither
# exported ref or builddir should have "flatpak run"
Expand Down
15 changes: 0 additions & 15 deletions flatpak_builder_lint/checks/finish_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,6 @@ def _validate(self, appid: Optional[str], finish_args: dict[str, Set[str]]) -> N
+ " has direct access to host dconf path"
)

pairs = (("home", "host"), ("home:ro", "host:ro"), ("home:rw", "host:rw"))
if any(all(k in finish_args["filesystem"] for k in p) for p in pairs):
self.errors.add("finish-args-redundant-home-and-host")
self.info.add(
"finish-args-redundant-home-and-host: finish-args has both host and home"
+ " filesystem access"
)

for own_name in finish_args["own-name"]:
if appid:
# Values not allowed: appid or appid.*
Expand Down Expand Up @@ -256,13 +248,6 @@ def _validate(self, appid: Optional[str], finish_args: dict[str, Set[str]]) -> N
+ " full system or session bus"
)

if "shm" in finish_args["device"]:
self.warnings.add("finish-args-deprecated-shm")

if "all" in finish_args["device"] and len(finish_args["device"]) > 1:
if "shm" not in finish_args["device"]:
self.warnings.add("finish-args-redundant-device-all")

def check_manifest(self, manifest: dict) -> None:
appid = manifest.get("id")
if isinstance(appid, str):
Expand Down
20 changes: 0 additions & 20 deletions flatpak_builder_lint/checks/metainfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,6 @@ def _validate(self, path: str, appid: str) -> None:
):
return

# for mypy
name = appstream.name(appstream_path)
summary = appstream.summary(appstream_path)

if name is not None and len(name) > 20:
self.warnings.add("appstream-name-too-long")
self.info.add(
"appstream-name-too-long: The value of name tag in metainfo"
+ " is more than 20 characters"
)
if summary is not None:
if len(summary) > 35:
self.warnings.add("appstream-summary-too-long")
self.info.add(
"appstream-summary-too-long: The value of summary tag in metainfo"
+ " is more than 35 characters"
)
if summary.endswith("."):
self.warnings.add("appstream-summary-ends-in-dot")

if not appstream.is_developer_name_present(appstream_path):
self.errors.add("appstream-missing-developer-name")
self.info.add(
Expand Down
5 changes: 0 additions & 5 deletions tests/builddir/finish_args_home_host/metadata

This file was deleted.

5 changes: 0 additions & 5 deletions tests/builddir/finish_args_shm/metadata

This file was deleted.

6 changes: 0 additions & 6 deletions tests/manifests/finish-args-shm.json

This file was deleted.

7 changes: 0 additions & 7 deletions tests/manifests/finish_args-home_host1.json

This file was deleted.

7 changes: 0 additions & 7 deletions tests/manifests/finish_args-home_host2.json

This file was deleted.

7 changes: 0 additions & 7 deletions tests/manifests/finish_args-home_host3.json

This file was deleted.

6 changes: 0 additions & 6 deletions tests/manifests/finish_args-home_host4.json

This file was deleted.

20 changes: 0 additions & 20 deletions tests/test_builddir.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def test_builddir_finish_args() -> None:
"finish-args-arbitrary-dbus-access",
"finish-args-flatpak-spawn-access",
"finish-args-incorrect-dbus-gvfs",
"finish-args-redundant-home-and-host",
"finish-args-unnecessary-appid-own-name",
"finish-args-wildcard-freedesktop-talk-name",
"finish-args-wildcard-gnome-own-name",
Expand All @@ -43,7 +42,6 @@ def test_builddir_finish_args() -> None:

warnings = {
"finish-args-x11-without-ipc",
"finish-args-redundant-device-all",
}

expected_absents = {
Expand All @@ -65,14 +63,6 @@ def test_builddir_finish_args() -> None:
)


def test_manifest_finish_args_shm() -> None:

ret = run_checks("tests/builddir/finish_args_shm")
found_warnings = set(ret["warnings"])

assert "finish-args-deprecated-shm" in found_warnings


def test_builddir_display_supported() -> None:

absents = {
Expand All @@ -86,13 +76,6 @@ def test_builddir_display_supported() -> None:
assert a not in found_errors


def test_manifest_finish_args_home_host() -> None:

ret = run_checks(f"tests/builddir/finish_args_home_host")
found_errors = set(ret["errors"])
assert "finish-args-redundant-home-and-host" not in found_errors


def test_builddir_finish_args_missing() -> None:
ret = run_checks("tests/builddir/finish_args_missing")
found_errors = set(ret["errors"])
Expand Down Expand Up @@ -185,10 +168,7 @@ def test_builddir_quality_guidelines() -> None:
"appstream-launchable-file-missing",
}
warnings = {
"appstream-name-too-long",
"appstream-screenshot-missing-caption",
"appstream-summary-too-long",
"appstream-summary-ends-in-dot",
}
found_warnings = set(ret["warnings"])
found_errors = set(ret["errors"])
Expand Down
29 changes: 0 additions & 29 deletions tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def test_manifest_finish_args() -> None:
"finish-args-arbitrary-dbus-access",
"finish-args-flatpak-spawn-access",
"finish-args-incorrect-dbus-gvfs",
"finish-args-redundant-home-and-host",
"finish-args-unnecessary-appid-own-name",
"finish-args-wildcard-freedesktop-talk-name",
"finish-args-wildcard-gnome-own-name",
Expand All @@ -153,7 +152,6 @@ def test_manifest_finish_args() -> None:

warnings = {
"finish-args-x11-without-ipc",
"finish-args-redundant-device-all",
"finish-args-contains-both-x11-and-fallback",
}

Expand Down Expand Up @@ -193,33 +191,6 @@ def test_manifest_finish_args_issue_33() -> None:
assert "finish-args-unnecessary-appid-own-name" in found_errors


def test_manifest_finish_args_shm() -> None:

ret = run_checks("tests/manifests/finish-args-shm.json")
found_warnings = set(ret["warnings"])

assert "finish-args-deprecated-shm" in found_warnings


def test_manifest_finish_args_home_host() -> None:

for file in (
"finish_args-home_host1.json",
"finish_args-home_host2.json",
):
ret = run_checks(f"tests/manifests/{file}")
found_errors = set(ret["errors"])
assert "finish-args-redundant-home-and-host" in found_errors

for file in (
"finish_args-home_host3.json",
"finish_args-home_host4.json",
):
ret = run_checks(f"tests/manifests/{file}")
found_errors = set(ret["errors"])
assert "finish-args-redundant-home-and-host" not in found_errors


def test_manifest_display_stuff() -> None:

absents = {
Expand Down

0 comments on commit ee08cf1

Please sign in to comment.