Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5840f88

Browse files
committed
Address review comments and test failures
1 parent afbc57f commit 5840f88

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

pre_commit/commands/run.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,20 @@ def run(config_file, store, args, environ=os.environ):
257257
for repo in repositories(config, store):
258258
for _, hook in repo.hooks:
259259
if (
260-
(not args.hook or hook['id'] == args.hook or (
261-
hook['alias'] and hook['alias'] == args.hook
262-
)) and
263-
(not hook['stages'] or args.hook_stage in hook['stages'])
260+
(
261+
not args.hook or
262+
hook['id'] == args.hook or
263+
hook['alias'] == args.hook
264+
) and
265+
(
266+
not hook['stages'] or
267+
args.hook_stage in hook['stages']
268+
)
264269
):
265270
repo_hooks.append((repo, hook))
266271

267272
if args.hook and not repo_hooks:
268-
output.write_line(
269-
'No hook with id or alias `{}`'.format(args.hook),
270-
)
273+
output.write_line('No hook with id `{}`'.format(args.hook))
271274
return 1
272275

273276
for repo in {repo for repo, _ in repo_hooks}:

tests/repository_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ def test_manifest_hooks(tempdir_factory, store):
831831
'exclude': '^$',
832832
'files': '',
833833
'id': 'bash_hook',
834+
'alias': '',
834835
'language': 'script',
835836
'language_version': 'default',
836837
'log_file': '',

0 commit comments

Comments
 (0)