mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 20:40:08 -06:00
Merge pull request #147 from pre-commit/print_hook_id_on_failure
Print hookid on failure.
This commit is contained in:
@@ -84,6 +84,7 @@ def _run_single_hook(runner, repository, hook_id, args, write, skips=set()):
|
||||
write(color.format_color(pass_fail, print_color, args.color) + '\n')
|
||||
|
||||
if (stdout or stderr) and (retcode or args.verbose):
|
||||
write('hookid: {0}\n'.format(hook['id']))
|
||||
write('\n')
|
||||
for output in (stdout, stderr):
|
||||
if output.strip():
|
||||
|
||||
@@ -157,6 +157,7 @@ FAILING_PRE_COMMIT_RUN = re.compile(
|
||||
r'\[INFO\] Once installed this environment will be reused\.\n'
|
||||
r'\[INFO\] This may take a few minutes\.\.\.\n'
|
||||
r'Failing hook\.+Failed\n'
|
||||
r'hookid: failing_hook\n'
|
||||
r'\n'
|
||||
r'Fail\n'
|
||||
r'foo\n'
|
||||
|
||||
@@ -77,7 +77,7 @@ def test_run_all_hooks_failing(
|
||||
_test_run(
|
||||
repo_with_failing_hook,
|
||||
{},
|
||||
('Failing hook', 'Failed', 'Fail\nfoo.py\n'),
|
||||
('Failing hook', 'Failed', 'hookid: failing_hook', 'Fail\nfoo.py\n'),
|
||||
1,
|
||||
True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user