mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 10:31:46 +04:00
pre_commit: expose fail-fast argument for run subcommand
This patch exposes the fail-fast feature as a command-line argument for the run subcommand, allowing to run pre-commit to stop at the first failed hook without the need of temporarily writing it to the configuration file when temporarily needed. Signed-off-by: Luís Ferreira <contact@lsferreira.net>
This commit is contained in:
parent
d021bbfabd
commit
61efc539a4
5 changed files with 23 additions and 2 deletions
|
|
@ -69,6 +69,7 @@ def _ns(
|
|||
color: bool,
|
||||
*,
|
||||
all_files: bool = False,
|
||||
fail_fast: bool = False,
|
||||
remote_branch: Optional[str] = None,
|
||||
local_branch: Optional[str] = None,
|
||||
from_ref: Optional[str] = None,
|
||||
|
|
@ -91,6 +92,7 @@ def _ns(
|
|||
remote_url=remote_url,
|
||||
commit_msg_filename=commit_msg_filename,
|
||||
all_files=all_files,
|
||||
fail_fast=fail_fast,
|
||||
checkout_type=checkout_type,
|
||||
is_squash_merge=is_squash_merge,
|
||||
rewrite_command=rewrite_command,
|
||||
|
|
|
|||
|
|
@ -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 args.fail_fast):
|
||||
break
|
||||
if retval and args.show_diff_on_failure and prior_diff:
|
||||
if args.all_files:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue