Use parens instead of different logic pattern.

This commit is contained in:
Matt Layman 2018-07-19 23:27:29 -04:00
parent a8b298799c
commit fd1bc21d8e

View file

@ -254,13 +254,11 @@ def run(runner, store, args, environ=os.environ):
repo_hooks = [] repo_hooks = []
for repo in repositories(runner.config, store): for repo in repositories(runner.config, store):
for _, hook in repo.hooks: for _, hook in repo.hooks:
if args.hook: if (
if args.hook == hook['id']: (not args.hook or hook['id'] == args.hook) and
repo_hooks.append((repo, hook)) (not hook['stages'] or args.hook_stage in hook['stages'])
break ):
else: repo_hooks.append((repo, hook))
if not hook['stages'] or args.hook_stage in hook['stages']:
repo_hooks.append((repo, hook))
if args.hook and not repo_hooks: if args.hook and not repo_hooks:
output.write_line('No hook with id `{}`'.format(args.hook)) output.write_line('No hook with id `{}`'.format(args.hook))