Skip to content

Commit

Permalink
Make help message a key-value pair in results dict
Browse files Browse the repository at this point in the history
bbhtt authored and barthalion committed Feb 12, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 2540d2e commit 258bb94
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions flatpak_builder_lint/cli.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import os
import pkgutil
import sys
from typing import Optional, Union
from typing import Dict, List, Optional, Union

import requests
import sentry_sdk
@@ -69,7 +69,7 @@ def run_checks(
if callable(check_method):
check_method(check_method_arg)

results = {}
results: Dict[str, Union[str, List[Optional[str]]]] = {}
if errors := checks.Check.errors:
results["errors"] = list(errors)
if warnings := checks.Check.warnings:
@@ -106,6 +106,14 @@ def run_checks(
if not results["warnings"]:
results.pop("warnings")

help = (
"Please consult the documentation at "
"https://docs.flathub.org/docs/for-app-authors/linter"
)

if "errors" in results or "warnings" in results:
results["message"] = help

return results


@@ -163,11 +171,6 @@ def main() -> int:

output = json.dumps(results, indent=4)
print(output)
if len(output) != 0:
print(
"\nPlease consult the documentation at"
" https://docs.flathub.org/docs/for-app-authors/linter"
)

sys.exit(exit_code)

0 comments on commit 258bb94

Please sign in to comment.