Implement default_stages · pre-commit/pre-commit@bd65d89 · GitHub
Skip to content

Commit bd65d89

Browse files
committed
Implement default_stages
1 parent 9c6a1d8 commit bd65d89

4 files changed

Lines changed: 29 additions & 3 deletions

File tree

‎pre_commit/clientlib.py‎

Lines changed: 5 additions & 0 deletions

‎pre_commit/commands/run.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def run(config_file, store, args, environ=os.environ):
252252
hook
253253
for hook in all_hooks(config, store)
254254
if not args.hook or hook.id == args.hook or hook.alias == args.hook
255-
if not hook.stages or args.hook_stage in hook.stages
255+
if args.hook_stage in hook.stages
256256
]
257257

258258
if args.hook and not hooks:

‎pre_commit/repository.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ def _hook(*hook_dicts, **kwargs):
135135
if ret['language_version'] == C.DEFAULT:
136136
ret['language_version'] = languages[lang].get_default_version()
137137

138+
if not ret['stages']:
139+
ret['stages'] = root_config['default_stages']
140+
138141
return ret
139142

140143

‎tests/repository_test.py‎

Lines changed: 20 additions & 2 deletions

0 commit comments

Comments
 (0)