mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
respect aliases SKIP when installing environments
This commit is contained in:
parent
49f95b9ef3
commit
19ca2077aa
2 changed files with 21 additions and 2 deletions
|
|
@ -420,7 +420,11 @@ def run(
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
skips = _get_skips(environ)
|
skips = _get_skips(environ)
|
||||||
to_install = [hook for hook in hooks if hook.id not in skips]
|
to_install = [
|
||||||
|
hook
|
||||||
|
for hook in hooks
|
||||||
|
if hook.id not in skips and hook.alias not in skips
|
||||||
|
]
|
||||||
install_hook_envs(to_install, store)
|
install_hook_envs(to_install, store)
|
||||||
|
|
||||||
return _run_hooks(config, hooks, skips, args)
|
return _run_hooks(config, hooks, skips, args)
|
||||||
|
|
|
||||||
|
|
@ -618,11 +618,19 @@ def test_skip_bypasses_installation(cap_out, store, repo_with_passing_hook):
|
||||||
'hooks': [
|
'hooks': [
|
||||||
{
|
{
|
||||||
'id': 'skipme',
|
'id': 'skipme',
|
||||||
'name': 'skipme',
|
'name': 'skipme-1',
|
||||||
'entry': 'skipme',
|
'entry': 'skipme',
|
||||||
|
'alias': 'skipme-1',
|
||||||
'language': 'python',
|
'language': 'python',
|
||||||
'additional_dependencies': ['/pre-commit-does-not-exist'],
|
'additional_dependencies': ['/pre-commit-does-not-exist'],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'id': 'skipme',
|
||||||
|
'name': 'skipme-2',
|
||||||
|
'entry': 'skipme',
|
||||||
|
'alias': 'skipme-2',
|
||||||
|
'language': 'python',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
add_config_to_repo(repo_with_passing_hook, config)
|
add_config_to_repo(repo_with_passing_hook, config)
|
||||||
|
|
@ -634,6 +642,13 @@ def test_skip_bypasses_installation(cap_out, store, repo_with_passing_hook):
|
||||||
)
|
)
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
|
|
||||||
|
ret, printed = _do_run(
|
||||||
|
cap_out, store, repo_with_passing_hook,
|
||||||
|
run_opts(all_files=True),
|
||||||
|
{'SKIP': 'skipme-1'},
|
||||||
|
)
|
||||||
|
assert ret == 1
|
||||||
|
|
||||||
|
|
||||||
def test_hook_id_not_in_non_verbose_output(
|
def test_hook_id_not_in_non_verbose_output(
|
||||||
cap_out, store, repo_with_passing_hook,
|
cap_out, store, repo_with_passing_hook,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue