Skip to content

Commit

Permalink
cli: Properly ignore info strings in exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Jun 19, 2024
1 parent 2b0e70a commit 427003e
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions flatpak_builder_lint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
importlib.import_module(f".{plugin_info.name}", package=checks.__name__)


def _filter(info: set, excepts: set) -> list:
final = set()
for i in info:
count = False
for j in excepts:
if i is not None and i.startswith(j):
count = True
break
if not count:
final.add(i)
return list(final)


def get_local_exceptions(appid: str) -> set:
with importlib.resources.open_text(staticfiles, "exceptions.json") as f:
exceptions = json.load(f)
Expand Down Expand Up @@ -114,16 +127,7 @@ def run_checks(
if "desktop-file-failed-validation" in set(exceptions):
results.pop("desktopfile", None)

results["info"] = list(
set(
[
i
for i in set(info)
for j in set(exceptions)
if i is not None and not i.startswith(j)
]
)
)
results["info"] = _filter(set(info), set(exceptions))
if not results["info"]:
results.pop("info")

Expand Down

0 comments on commit 427003e

Please sign in to comment.