Repository: pre-commit/pre-commit
Pull request #678 (2018-01-09 15:52:48)

Replace string literals with constants


Patch:
diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py
index 3a08c8d..c70eff0 100644
--- a/pre_commit/commands/run.py
+++ b/pre_commit/commands/run.py
@@ -223,8 +223,8 @@ def run(runner, args, environ=os.environ):
         return 1
     if _has_unstaged_config(runner) and not no_stash:
         logger.error(
-            'Your .pre-commit-config.yaml is unstaged.\n'
-            '`git add .pre-commit-config.yaml` to fix this.',
+            'Your pre-commit configuration is unstaged.\n'
+            '`git add {}` to fix this.'.format(runner.config_file),
         )
         return 1
 
diff --git a/pre_commit/main.py b/pre_commit/main.py
index 4c9202a..865571a 100644
--- a/pre_commit/main.py
+++ b/pre_commit/main.py
@@ -42,7 +42,7 @@ def _add_color_option(parser):
 
 def _add_config_option(parser):
     parser.add_argument(
-        '-c', '--config', default='.pre-commit-config.yaml',
+        '-c', '--config', default=C.CONFIG_FILE,
         help='Path to alternate config file',
     )
 
diff --git a/pre_commit/repository.py b/pre_commit/repository.py
index bc0ecad..5c11921 100644
--- a/pre_commit/repository.py
+++ b/pre_commit/repository.py
@@ -269,14 +269,14 @@ class MetaRepository(LocalRepository):
             {
                 'id': 'check-hooks-apply',
                 'name': 'Check hooks apply to the repository',
-                'files': '.pre-commit-config.yaml',
+                'files': C.CONFIG_FILE,
                 'language': 'system',
                 'entry': _make_entry(check_hooks_apply),
             },
             {
                 'id': 'check-useless-excludes',
                 'name': 'Check for useless excludes',
-                'files': '.pre-commit-config.yaml',
+                'files': C.CONFIG_FILE,
                 'language': 'system',
                 'entry': _make_entry(check_useless_excludes),
             },


Test patch:
diff --git a/testing/fixtures.py b/testing/fixtures.py
index b1c7a89..edb1bcd 100644
--- a/testing/fixtures.py
+++ b/testing/fixtures.py
@@ -47,7 +47,7 @@ def modify_manifest(path):
     with io.open(manifest_path, 'w') as manifest_file:
         manifest_file.write(ordered_dump(manifest, **C.YAML_DUMP_KWARGS))
     cmd_output(
-        'git', 'commit', '-am', 'update .pre-commit-hooks.yaml', cwd=path,
+        'git', 'commit', '-am', 'update {}'.format(C.MANIFEST_FILE), cwd=path,
     )
 
 
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index 336222d..97c82c2 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -683,7 +683,7 @@ def test_error_with_unstaged_config(
 ):
     args = run_opts()
     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
 
 
@@ -695,7 +695,7 @@ def test_no_unstaged_error_with_all_files_or_files(
 ):
     args = run_opts(**opts)
     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(