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
  • Loading branch information
bbhtt committed Feb 12, 2024
1 parent 2540d2e commit 3291c1c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions flatpak_builder_lint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -106,6 +106,12 @@ 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


Expand Down Expand Up @@ -163,11 +169,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)

Expand Down

0 comments on commit 3291c1c

Please sign in to comment.