mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 13:00:10 -06:00
Merge pull request #1771 from pre-commit/no_install_language_options
produce a more useful error message when non-installable things use language_version or additional_dependencies
This commit is contained in:
@@ -118,6 +118,24 @@ def _hook(
|
||||
if not ret['stages']:
|
||||
ret['stages'] = root_config['default_stages']
|
||||
|
||||
if languages[lang].ENVIRONMENT_DIR is None:
|
||||
if ret['language_version'] != C.DEFAULT:
|
||||
logger.error(
|
||||
f'The hook `{ret["id"]}` specifies `language_version` but is '
|
||||
f'using language `{lang}` which does not install an '
|
||||
f'environment. '
|
||||
f'Perhaps you meant to use a specific language?',
|
||||
)
|
||||
exit(1)
|
||||
if ret['additional_dependencies']:
|
||||
logger.error(
|
||||
f'The hook `{ret["id"]}` specifies `additional_dependencies` '
|
||||
f'but is using language `{lang}` which does not install an '
|
||||
f'environment. '
|
||||
f'Perhaps you meant to use a specific language?',
|
||||
)
|
||||
exit(1)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user