mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
POC for --dry-run param in run command
This commit is contained in:
parent
2280645d0e
commit
455fc07ad9
10 changed files with 40 additions and 10 deletions
|
|
@ -55,6 +55,7 @@ class Language(Protocol):
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]:
|
||||
...
|
||||
|
||||
|
|
@ -158,6 +159,7 @@ def run_xargs(
|
|||
*,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]:
|
||||
if require_serial:
|
||||
jobs = 1
|
||||
|
|
@ -167,7 +169,7 @@ def run_xargs(
|
|||
# ordering.
|
||||
file_args = _shuffled(file_args)
|
||||
jobs = target_concurrency()
|
||||
return xargs.xargs(cmd, file_args, target_concurrency=jobs, color=color)
|
||||
return xargs.xargs(cmd, file_args, target_concurrency=jobs, color=color, dry_run=dry_run)
|
||||
|
||||
|
||||
def hook_cmd(entry: str, args: Sequence[str]) -> tuple[str, ...]:
|
||||
|
|
@ -183,10 +185,12 @@ def basic_run_hook(
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]:
|
||||
return run_xargs(
|
||||
hook_cmd(entry, args),
|
||||
file_args,
|
||||
require_serial=require_serial,
|
||||
color=color,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue