From c08400e2bca6af6c65d228c666a5c35a3e67bfc3 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 30 Jan 2017 20:42:01 -0800 Subject: [PATCH] Improve messaging for missing hook given #480 --- pre_commit/repository.py | 4 +--- tests/repository_test.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pre_commit/repository.py b/pre_commit/repository.py index 54f25e01..748d84b5 100644 --- a/pre_commit/repository.py +++ b/pre_commit/repository.py @@ -78,9 +78,7 @@ class Repository(object): logger.error( '`{}` is not present in repository {}. ' 'Typo? Perhaps it is introduced in a newer version? ' - 'Often you can fix this by removing the hook, running ' - '`pre-commit autoupdate`, ' - 'and then adding the hook.'.format( + 'Often `pre-commit autoupdate` fixes this.'.format( hook['id'], self.repo_config['repo'], ) ) diff --git a/tests/repository_test.py b/tests/repository_test.py index ee03ccef..9df33448 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -696,9 +696,7 @@ def test_hook_id_not_present(tempdir_factory, store, fake_log_handler): assert fake_log_handler.handle.call_args[0][0].msg == ( '`i-dont-exist` is not present in repository {}. ' 'Typo? Perhaps it is introduced in a newer version? ' - 'Often you can fix this by removing the hook, ' - 'running `pre-commit autoupdate`, ' - 'and then adding the hook.'.format(path) + 'Often `pre-commit autoupdate` fixes this.'.format(path) )