diff --git a/pre_commit_hooks/trailing_whitespace_fixer.py b/pre_commit_hooks/trailing_whitespace_fixer.py index 05ed999..f1446a7 100644 --- a/pre_commit_hooks/trailing_whitespace_fixer.py +++ b/pre_commit_hooks/trailing_whitespace_fixer.py @@ -42,6 +42,14 @@ def _process_line( def main(argv: Optional[Sequence[str]] = None) -> int: parser = argparse.ArgumentParser() + parser.add_argument( + '--no-fail', + action='store_false', + help=( + 'Always return a successful return code. ' + 'Defaults to false.' + ), + ) parser.add_argument( '--no-markdown-linebreak-ext', action='store_true', @@ -95,6 +103,8 @@ def main(argv: Optional[Sequence[str]] = None) -> int: if _fix_file(filename, md, chars): print(f'Fixing {filename}') return_code = 1 + if args.no_fail: + return_code = 0 return return_code