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

Skip to content

Commit fd1bc21

Browse files
committed
Use parens instead of different logic pattern.
1 parent a8b2987 commit fd1bc21

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

pre_commit/commands/run.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,11 @@ def run(runner, store, args, environ=os.environ):
254254
repo_hooks = []
255255
for repo in repositories(runner.config, store):
256256
for _, hook in repo.hooks:
257-
if args.hook:
258-
if args.hook == hook['id']:
259-
repo_hooks.append((repo, hook))
260-
break
261-
else:
262-
if not hook['stages'] or args.hook_stage in hook['stages']:
263-
repo_hooks.append((repo, hook))
257+
if (
258+
(not args.hook or hook['id'] == args.hook) and
259+
(not hook['stages'] or args.hook_stage in hook['stages'])
260+
):
261+
repo_hooks.append((repo, hook))
264262

265263
if args.hook and not repo_hooks:
266264
output.write_line('No hook with id `{}`'.format(args.hook))

0 commit comments

Comments
 (0)