mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Python 3 compatibility.
This commit is contained in:
parent
ddebb83a40
commit
bb365a6e68
10 changed files with 30 additions and 27 deletions
|
|
@ -45,7 +45,6 @@ def _run_single_hook(runner, repository, hook_id, args):
|
|||
get_filenames(hook['files'], hook['exclude']),
|
||||
)
|
||||
|
||||
output = '\n'.join([stdout, stderr]).strip()
|
||||
if retcode != repository.hooks[hook_id]['expected_return_value']:
|
||||
retcode = 1
|
||||
print_color = color.RED
|
||||
|
|
@ -57,8 +56,12 @@ def _run_single_hook(runner, repository, hook_id, args):
|
|||
|
||||
print(color.format_color(pass_fail, print_color, args.color))
|
||||
|
||||
if output and (retcode or args.verbose):
|
||||
print('\n' + output)
|
||||
if (stdout or stderr) and (retcode or args.verbose):
|
||||
print()
|
||||
for output in (stdout, stderr):
|
||||
if output.strip():
|
||||
print(output.strip())
|
||||
print()
|
||||
|
||||
return retcode
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue