mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-13 11:49:24 -06:00
Produce a useful error message when hook id is not present. Resolves #194
This commit is contained in:
@@ -61,7 +61,16 @@ class Repository(object):
|
||||
|
||||
@cached_property
|
||||
def hooks(self):
|
||||
# TODO: merging in manifest dicts is a smell imo
|
||||
for hook in self.repo_config['hooks']:
|
||||
if hook['id'] not in self.manifest.hooks:
|
||||
logger.error(
|
||||
'`{0}` is not present in repository {1}. '
|
||||
'Typo? Perhaps it is introduced in a newer version? '
|
||||
'Often `pre-commit autoupdate` fixes this.'.format(
|
||||
hook['id'], self.repo_config['repo'],
|
||||
)
|
||||
)
|
||||
exit(1)
|
||||
return tuple(
|
||||
(hook['id'], dict(self.manifest.hooks[hook['id']], **hook))
|
||||
for hook in self.repo_config['hooks']
|
||||
|
||||
Reference in New Issue
Block a user