Minor fixups

This commit is contained in:
Anthony Sottile 2017-02-23 13:11:40 -08:00
parent 478b0c70d8
commit dbd131f646
4 changed files with 22 additions and 18 deletions

View file

@ -39,7 +39,7 @@ def is_previous_pre_commit(filename):
def install(
runner, overwrite=False, hooks=False, hook_type='pre-commit',
skip_on_missing_conf=False
skip_on_missing_conf=False,
):
"""Install the pre-commit hooks."""
hook_path = runner.get_hook_path(hook_type)
@ -78,7 +78,7 @@ def install(
sys_executable=sys.executable,
hook_type=hook_type,
pre_push=pre_push_contents,
skip_on_missing_conf=skip_on_missing_conf
skip_on_missing_conf=skip_on_missing_conf,
)
pre_commit_file_obj.write(contents)
make_executable(hook_path)

View file

@ -189,7 +189,7 @@ def main(argv=None):
return install(
runner, overwrite=args.overwrite, hooks=args.install_hooks,
hook_type=args.hook_type,
skip_on_missing_conf=args.allow_missing_config
skip_on_missing_conf=args.allow_missing_config,
)
elif args.command == 'install-hooks':
return install_hooks(runner)

View file

@ -41,13 +41,13 @@ fi
CONF_FILE=$(git rev-parse --show-toplevel)"/.pre-commit-config.yaml"
if [ ! -f $CONF_FILE ]; then
if [ $SKIP_ON_MISSING_CONF = true ] || [ ! -z $PRE_COMMIT_ALLOW_NO_CONFIG ]; then
echo '`.pre-commit-config.yaml` config file not found. Skipping `pre-commit`.'
exit $retv
echo '`.pre-commit-config.yaml` config file not found. Skipping `pre-commit`.'
exit $retv
else
echo 'No .pre-commit-config.yaml file was found\n'\
'- To temporarily silence this, run `PRE_COMMIT_ALLOW_NO_CONFIG=1 git ...`\n'\
'- To permanently silence this, install pre-commit with the `--allow-missing-config` option\n'\
'- To uninstall pre-commit run `pre-commit uninstall`'
echo 'No .pre-commit-config.yaml file was found'
echo '- To temporarily silence this, run `PRE_COMMIT_ALLOW_NO_CONFIG=1 git ...`'
echo '- To permanently silence this, install pre-commit with the `--allow-missing-config` option'
echo '- To uninstall pre-commit run `pre-commit uninstall`'
exit 1
fi
fi