Merge pull request #678 from revolter/hotfix/replace-with-constants

Replace string literals with constants
This commit is contained in:
Anthony Sottile 2018-01-09 09:07:34 -08:00 committed by GitHub
commit 0628df535b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View file

@ -223,8 +223,8 @@ def run(runner, args, environ=os.environ):
return 1 return 1
if _has_unstaged_config(runner) and not no_stash: if _has_unstaged_config(runner) and not no_stash:
logger.error( logger.error(
'Your .pre-commit-config.yaml is unstaged.\n' 'Your pre-commit configuration is unstaged.\n'
'`git add .pre-commit-config.yaml` to fix this.', '`git add {}` to fix this.'.format(runner.config_file),
) )
return 1 return 1

View file

@ -42,7 +42,7 @@ def _add_color_option(parser):
def _add_config_option(parser): def _add_config_option(parser):
parser.add_argument( parser.add_argument(
'-c', '--config', default='.pre-commit-config.yaml', '-c', '--config', default=C.CONFIG_FILE,
help='Path to alternate config file', help='Path to alternate config file',
) )

View file

@ -269,14 +269,14 @@ class MetaRepository(LocalRepository):
{ {
'id': 'check-hooks-apply', 'id': 'check-hooks-apply',
'name': 'Check hooks apply to the repository', 'name': 'Check hooks apply to the repository',
'files': '.pre-commit-config.yaml', 'files': C.CONFIG_FILE,
'language': 'system', 'language': 'system',
'entry': _make_entry(check_hooks_apply), 'entry': _make_entry(check_hooks_apply),
}, },
{ {
'id': 'check-useless-excludes', 'id': 'check-useless-excludes',
'name': 'Check for useless excludes', 'name': 'Check for useless excludes',
'files': '.pre-commit-config.yaml', 'files': C.CONFIG_FILE,
'language': 'system', 'language': 'system',
'entry': _make_entry(check_useless_excludes), 'entry': _make_entry(check_useless_excludes),
}, },

View file

@ -47,7 +47,7 @@ def modify_manifest(path):
with io.open(manifest_path, 'w') as manifest_file: with io.open(manifest_path, 'w') as manifest_file:
manifest_file.write(ordered_dump(manifest, **C.YAML_DUMP_KWARGS)) manifest_file.write(ordered_dump(manifest, **C.YAML_DUMP_KWARGS))
cmd_output( cmd_output(
'git', 'commit', '-am', 'update .pre-commit-hooks.yaml', cwd=path, 'git', 'commit', '-am', 'update {}'.format(C.MANIFEST_FILE), cwd=path,
) )

View file

@ -683,7 +683,7 @@ def test_error_with_unstaged_config(
): ):
args = run_opts() args = run_opts()
ret, printed = _do_run(cap_out, modified_config_repo, args) ret, printed = _do_run(cap_out, modified_config_repo, args)
assert b'Your .pre-commit-config.yaml is unstaged.' in printed assert b'Your pre-commit configuration is unstaged.' in printed
assert ret == 1 assert ret == 1
@ -695,7 +695,7 @@ def test_no_unstaged_error_with_all_files_or_files(
): ):
args = run_opts(**opts) args = run_opts(**opts)
ret, printed = _do_run(cap_out, modified_config_repo, args) ret, printed = _do_run(cap_out, modified_config_repo, args)
assert b'Your .pre-commit-config.yaml is unstaged.' not in printed assert b'Your pre-commit configuration is unstaged.' not in printed
def test_files_running_subdir( def test_files_running_subdir(