Repository: pre-commit/pre-commit (python)

Issue:
"identity" meta hook
Pretty often I or a bug reporter reaches for the "simplest hook possible" -- often to debug what files are being passed through.

Let's add an "identity" hook which does the following:

1. Is always verbose
2. prints the filenames passed to it
3. Always succeeds

Basically make something like this, but without depending on "actual" `echo`:

```yaml
-   id: identity
    name: identity
    entry: echo
    verbose: true
    language: system
```

Pull request:
Add identity meta hook
Resolves #865 

Patch:
diff --git a/pre_commit/meta_hooks/identity.py b/pre_commit/meta_hooks/identity.py
new file mode 100644
index 0000000..ae7377b
--- /dev/null
+++ b/pre_commit/meta_hooks/identity.py
@@ -0,0 +1,13 @@
+import sys
+
+from pre_commit import output
+
+
+def main(argv=None):
+    argv = argv if argv is not None else sys.argv[1:]
+    for arg in argv:
+        output.write_line(arg)
+
+
+if __name__ == '__main__':
+    exit(main())
diff --git a/pre_commit/repository.py b/pre_commit/repository.py
index 2a43550..e245a1a 100644
--- a/pre_commit/repository.py
+++ b/pre_commit/repository.py
@@ -237,6 +237,7 @@ class MetaRepository(LocalRepository):
         # The hooks are imported here to prevent circular imports.
         from pre_commit.meta_hooks import check_hooks_apply
         from pre_commit.meta_hooks import check_useless_excludes
+        from pre_commit.meta_hooks import identity
 
         def _make_entry(mod):
             """the hook `entry` is passed through `shlex.split()` by the
@@ -260,6 +261,13 @@ class MetaRepository(LocalRepository):
                 'language': 'system',
                 'entry': _make_entry(check_useless_excludes),
             },
+            {
+                'id': 'identity',
+                'name': 'identity',
+                'language': 'system',
+                'verbose': True,
+                'entry': _make_entry(identity),
+            },
         ]
 
         return {


Test patch:
diff --git a/tests/meta_hooks/identity_test.py b/tests/meta_hooks/identity_test.py
new file mode 100644
index 0000000..3eff00b
--- /dev/null
+++ b/tests/meta_hooks/identity_test.py
@@ -0,0 +1,6 @@
+from pre_commit.meta_hooks import identity
+
+
+def test_identity(cap_out):
+    assert not identity.main(('a', 'b', 'c'))
+    assert cap_out.get() == 'a\nb\nc\n'