[gi-docgen/check-ignore: 6/6] Handle return values consistently
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gi-docgen/check-ignore: 6/6] Handle return values consistently
- Date: Fri, 11 Jun 2021 12:52:40 +0000 (UTC)
commit fafe5ec25a3df77feb439f47e4f3b9ff072b057f
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Jun 11 13:51:56 2021 +0100
Handle return values consistently
We should always return an integer value—zero for success, non-zero for
failure.
gidocgen/gdcheck.py | 5 ++++-
gidocgen/log.py | 6 ++++--
2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gidocgen/gdcheck.py b/gidocgen/gdcheck.py
index bb28c9f..73d29f0 100644
--- a/gidocgen/gdcheck.py
+++ b/gidocgen/gdcheck.py
@@ -340,7 +340,10 @@ def check(repository, config):
for res in results:
log.warning(res)
- return len(results) == 0
+ if len(results) == 0:
+ return 0
+ else:
+ return 1
def add_args(parser):
diff --git a/gidocgen/log.py b/gidocgen/log.py
index 9e4e4cc..e5a2262 100644
--- a/gidocgen/log.py
+++ b/gidocgen/log.py
@@ -200,11 +200,13 @@ def checkpoint(prefix=None):
def report():
+ global log_warnings_counter
if log_quiet:
return
elapsed = (time.monotonic() - log_epoch)
report = [""]
report += [f"Elapsed time: {elapsed:.3f} seconds"]
report += [f"Total warnings: {log_warnings_counter}"]
- print("\n".join(report))
- return log_warnings_counter != 0
+ if log_warnings_counter == 0:
+ return 0
+ return 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]