Repository: pre-commit/pre-commit

Issue:
Create `language: fail` for filename-only checks
For example, it would be useful here:

https://github.com/pytest-dev/pytest/pull/3765/files

v1 could just print the filenames and exit nonzero, potentially with a `--message` option.

Discussion:

Patch:
diff --git a/pre_commit/languages/all.py b/pre_commit/languages/all.py
index be74ffd..a019ddf 100644
--- a/pre_commit/languages/all.py
+++ b/pre_commit/languages/all.py
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
 
 from pre_commit.languages import docker
 from pre_commit.languages import docker_image
+from pre_commit.languages import fail
 from pre_commit.languages import golang
 from pre_commit.languages import node
 from pre_commit.languages import pcre
@@ -54,6 +55,7 @@ from pre_commit.languages import system
 languages = {
     'docker': docker,
     'docker_image': docker_image,
+    'fail': fail,
     'golang': golang,
     'node': node,
     'pcre': pcre,
diff --git a/pre_commit/languages/fail.py b/pre_commit/languages/fail.py
new file mode 100644
index 0000000..c69fcae
--- /dev/null
+++ b/pre_commit/languages/fail.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+
+from pre_commit.languages import helpers
+
+
+ENVIRONMENT_DIR = None
+get_default_version = helpers.basic_get_default_version
+healthy = helpers.basic_healthy
+install_environment = helpers.no_install
+
+
+def run_hook(prefix, hook, file_args):
+    out = hook['entry'].encode('UTF-8') + b'\n\n'
+    out += b'\n'.join(f.encode('UTF-8') for f in file_args) + b'\n'
+    return 1, out, b''


Test patch:
diff --git a/tests/repository_test.py b/tests/repository_test.py
index 95506ee..4c76f9a 100644
--- a/tests/repository_test.py
+++ b/tests/repository_test.py
@@ -589,6 +589,29 @@ def test_local_rust_additional_dependencies(store):
     assert _norm_out(ret[1]) == b"Hello World!\n"
 
 
+def test_fail_hooks(store):
+    config = {
+        'repo': 'local',
+        'hooks': [{
+            'id': 'fail',
+            'name': 'fail',
+            'language': 'fail',
+            'entry': 'make sure to name changelogs as .rst!',
+            'files': r'changelog/.*(?<!\.rst)$',
+        }],
+    }
+    repo = Repository.create(config, store)
+    (_, hook), = repo.hooks
+    ret = repo.run_hook(hook, ('changelog/1234.bugfix', 'changelog/wat'))
+    assert ret[0] == 1
+    assert ret[1] == (
+        b'make sure to name changelogs as .rst!\n'
+        b'\n'
+        b'changelog/1234.bugfix\n'
+        b'changelog/wat\n'
+    )
+
+
 def test_reinstall(tempdir_factory, store, log_info_mock):
     path = make_repo(tempdir_factory, 'python_hooks_repo')
     config = make_config_from_repo(path)