From f8c8b7ee8af2c957c59224c1b897939aef304ca7 Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Sat, 22 Aug 2020 23:19:46 +0100 Subject: [PATCH] Success should not be silent in --quiet mode Adding a new summary line if all hooks passed or were skipped in either --quiet mode (where it may be the only output) or --verbose mode (since the summary seems worth showing here). --- pre_commit/commands/run.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index 42a6e332..e41ad2bc 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -298,6 +298,12 @@ def _run_hooks( retval |= current_retval if retval and config['fail_fast']: break + if (args.quiet or args.verbose) and not retval: + # Do not want success with --quiet to be absolutely silent + # (would not know if any checks have been made at all) + output.write_line( + f'All {len(hooks)} pre-commit hook(s) passed or skipped', + ) if retval and args.show_diff_on_failure and prior_diff: if args.all_files: output.write_line(