mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Add fail_fast support per-hook
This commit is contained in:
parent
ae53a8eb65
commit
63ae399db0
5 changed files with 16 additions and 1 deletions
|
|
@ -70,6 +70,7 @@ MANIFEST_HOOK_DICT = cfgv.Map(
|
|||
),
|
||||
cfgv.Optional('args', cfgv.check_array(cfgv.check_string), []),
|
||||
cfgv.Optional('always_run', cfgv.check_bool, False),
|
||||
cfgv.Optional('fail_fast', cfgv.check_bool, False),
|
||||
cfgv.Optional('pass_filenames', cfgv.check_bool, True),
|
||||
cfgv.Optional('description', cfgv.check_string, ''),
|
||||
cfgv.Optional('language_version', cfgv.check_string, C.DEFAULT),
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ def _run_hooks(
|
|||
verbose=args.verbose, use_color=args.color,
|
||||
)
|
||||
retval |= current_retval
|
||||
if retval and config['fail_fast']:
|
||||
if retval and (config['fail_fast'] or hook.fail_fast):
|
||||
break
|
||||
if retval and args.show_diff_on_failure and prior_diff:
|
||||
if args.all_files:
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class Hook(NamedTuple):
|
|||
additional_dependencies: Sequence[str]
|
||||
args: Sequence[str]
|
||||
always_run: bool
|
||||
fail_fast: bool
|
||||
pass_filenames: bool
|
||||
description: str
|
||||
language_version: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue