mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Address review comments and test failures
This commit is contained in:
parent
afbc57f2ad
commit
5840f880a9
2 changed files with 11 additions and 7 deletions
|
|
@ -257,17 +257,20 @@ def run(config_file, store, args, environ=os.environ):
|
||||||
for repo in repositories(config, store):
|
for repo in repositories(config, store):
|
||||||
for _, hook in repo.hooks:
|
for _, hook in repo.hooks:
|
||||||
if (
|
if (
|
||||||
(not args.hook or hook['id'] == args.hook or (
|
(
|
||||||
hook['alias'] and hook['alias'] == args.hook
|
not args.hook or
|
||||||
)) and
|
hook['id'] == args.hook or
|
||||||
(not hook['stages'] or args.hook_stage in hook['stages'])
|
hook['alias'] == args.hook
|
||||||
|
) and
|
||||||
|
(
|
||||||
|
not hook['stages'] or
|
||||||
|
args.hook_stage in hook['stages']
|
||||||
|
)
|
||||||
):
|
):
|
||||||
repo_hooks.append((repo, hook))
|
repo_hooks.append((repo, hook))
|
||||||
|
|
||||||
if args.hook and not repo_hooks:
|
if args.hook and not repo_hooks:
|
||||||
output.write_line(
|
output.write_line('No hook with id `{}`'.format(args.hook))
|
||||||
'No hook with id or alias `{}`'.format(args.hook),
|
|
||||||
)
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
for repo in {repo for repo, _ in repo_hooks}:
|
for repo in {repo for repo, _ in repo_hooks}:
|
||||||
|
|
|
||||||
|
|
@ -831,6 +831,7 @@ def test_manifest_hooks(tempdir_factory, store):
|
||||||
'exclude': '^$',
|
'exclude': '^$',
|
||||||
'files': '',
|
'files': '',
|
||||||
'id': 'bash_hook',
|
'id': 'bash_hook',
|
||||||
|
'alias': '',
|
||||||
'language': 'script',
|
'language': 'script',
|
||||||
'language_version': 'default',
|
'language_version': 'default',
|
||||||
'log_file': '',
|
'log_file': '',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue