mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 01:51:46 +04:00
Add freeze config option for autoupdate command
This commit adds a new 'freeze' option to the CONFIG_SCHEMA, allowing users to set 'freeze: true' in their pre-commit configuration file. The intend are two effects, when setting `freeze: True`: * Enables freeze automatically when running `pre-commit autoupdate` (no need then anymore to specify --freeze). * Enables https://pre-commit.ci/ to freeze hooks as part of update PRs.
This commit is contained in:
parent
aa48766b88
commit
7c81f11d63
3 changed files with 15 additions and 0 deletions
|
|
@ -466,6 +466,7 @@ CONFIG_SCHEMA = cfgv.Map(
|
|||
cfgv.Optional('files', check_string_regex, ''),
|
||||
cfgv.Optional('exclude', check_string_regex, '^$'),
|
||||
cfgv.Optional('fail_fast', cfgv.check_bool, False),
|
||||
cfgv.Optional('freeze', cfgv.check_bool, False),
|
||||
cfgv.WarnAdditionalKeys(
|
||||
(
|
||||
'repos',
|
||||
|
|
@ -477,6 +478,7 @@ CONFIG_SCHEMA = cfgv.Map(
|
|||
'fail_fast',
|
||||
'minimum_pre_commit_version',
|
||||
'ci',
|
||||
'freeze',
|
||||
),
|
||||
warn_unknown_keys_root,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ def autoupdate(
|
|||
if repo['repo'] not in {LOCAL, META}
|
||||
]
|
||||
|
||||
freeze = freeze or load_config(config_file)['freeze']
|
||||
|
||||
rev_infos: list[RevInfo | None] = [None] * len(config_repos)
|
||||
jobs = jobs or xargs.cpu_count() # 0 => number of cpus
|
||||
jobs = min(jobs, len(repos) or len(config_repos)) # max 1-per-thread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue