Skip to content

Commit 472447d

Browse files
committed
Add option "-i" (or "--ignore-errors") to ignore errors and always return 0
1 parent 2fbb6b9 commit 472447d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

ChangeLog.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
== Version 3.1 (under dev)
88

9+
* add option "-i" (or "--ignore-errors"): always return 0 even if errors are found
910
* fix parsing of "noqa" tag in comments (issue #11)
1011
* use pytest for unit tests
1112
* replace Travis CI by GitHub Actions

msgcheck/msgcheck.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def msgcheck_parser():
5858
Argument "@file.txt" can be used to read default options in a file.
5959
6060
The script returns:
61-
0: all files checked are OK (or --extract/--only-misspelled given)
61+
0: all files checked are OK (or one of these options given:
62+
--extract, --only-misspelled or --ignore-errors given)
6263
n: number of files with errors (1 ≤ n ≤ 255)
6364
''')
6465
parser.add_argument('-c', '--no-compile', action='store_true',
@@ -93,6 +94,8 @@ def msgcheck_parser():
9394
help='display all translations and exit '
9495
'(all checks except compilation are disabled in '
9596
'this mode)')
97+
parser.add_argument('-i', '--ignore-errors', action='store_true',
98+
help='display but ignore errors (always return 0)')
9699
parser.add_argument('-q', '--quiet', action='store_true',
97100
help='quiet mode: only display number of errors')
98101
parser.add_argument('-v', '--version', action='version',
@@ -195,7 +198,7 @@ def main(): # pylint: disable=too-many-branches
195198
args = msgcheck_args(msgcheck_parser())
196199
result = msgcheck_check_files(args)
197200
files_with_errors = msgcheck_display_result(args, result)
198-
sys.exit(min(files_with_errors, 255))
201+
sys.exit(0 if args.ignore_errors else min(files_with_errors, 255))
199202

200203

201204
if __name__ == "__main__":

0 commit comments

Comments
 (0)