From 75562973377e3ade46b923061776b124202abf67 Mon Sep 17 00:00:00 2001
From: Peter Cock
Date: Mon, 24 Aug 2020 19:14:52 +0100
Subject: [PATCH] Revert "Hide passed lines in --quiet mode"
This reverts commit 5c1a7499cf3248f28f581c5a399d43b57110b48d.
Feedback from Anthony Sottile was to focus on the skipped
messages only for now.
---
pre_commit/commands/run.py | 36 +++++++++---------------------------
1 file changed, 9 insertions(+), 27 deletions(-)
diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py
index e41ad2bc..3f3ddbb7 100644
--- a/pre_commit/commands/run.py
+++ b/pre_commit/commands/run.py
@@ -123,7 +123,6 @@ def _get_skips(environ: EnvironT) -> Set[str]:
SKIPPED = 'Skipped'
NO_FILES = '(no files to check)'
-FAILED = 'Failed'
def _subtle_line(s: str, use_color: bool) -> None:
@@ -177,8 +176,7 @@ def _run_single_hook(
out = b''
else:
# print hook and dots first in case the hook takes a while to run
- if not quiet:
- output.write(_start_msg(start=hook.name, end_len=6, cols=cols))
+ output.write(_start_msg(start=hook.name, end_len=6, cols=cols))
if not hook.pass_filenames:
filenames = ()
@@ -191,32 +189,16 @@ def _run_single_hook(
# if the hook makes changes, fail the commit
files_modified = diff_before != diff_after
- if not quiet:
- # Finish the partial line of output...
- if retcode or files_modified:
- print_color = color.RED
- status = FAILED
- else:
- print_color = color.GREEN
- status = 'Passed'
- output.write_line(
- color.format_color(status, print_color, use_color),
- )
+ if retcode or files_modified:
+ print_color = color.RED
+ status = 'Failed'
+ else:
+ print_color = color.GREEN
+ status = 'Passed'
+
+ output.write_line(color.format_color(status, print_color, use_color))
if verbose or hook.verbose or retcode or files_modified:
- if quiet:
- # Normal would have written this in two stages:
- output.write(
- _full_msg(
- start=hook.name,
- postfix=NO_FILES,
- end_msg=FAILED,
- end_color=color.RED,
- use_color=use_color,
- cols=cols,
- ),
- )
-
_subtle_line(f'- hook id: {hook.id}', use_color)
if (verbose or hook.verbose) and duration is not None: