summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2018-03-29 10:10:25 -0700
committerJoris Roovers <joris.roovers@gmail.com>2018-03-29 19:10:25 +0200
commit1c36d7d939b7f65cc0757067c20115d056e4b01f (patch)
tree032073a1df819130605259ca79f70ba8f59e3912
parent941b76a4bf597d97e2a3731381beefff51aa7c30 (diff)
Add pre-commit metadata (#62)
This enables out-of-the-box usage with https://pre-commit.com as a commit-msg hook.
-rw-r--r--.pre-commit-hooks.yaml5
-rw-r--r--docs/index.md13
2 files changed, 18 insertions, 0 deletions
diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml
new file mode 100644
index 0000000..be4a6e9
--- /dev/null
+++ b/.pre-commit-hooks.yaml
@@ -0,0 +1,5 @@
+- id: gitlint
+ name: gitlint
+ language: python
+ entry: gitlint --msg-filename
+ stages: [commit-msg]
diff --git a/docs/index.md b/docs/index.md
index 7df8ae6..1ebdd6b 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -135,6 +135,19 @@ gitlint uninstall-hook
file in your local repository, gitlint will refuse to install the ```commit-msg``` hook. Gitlint will also only
uninstall unmodified commit-msg hooks that were installed by gitlint.
+## Using gitlint through [pre-commit](https://pre-commit.com)
+
+`gitlint` can be configured as a plugin for the `pre-commit` git hooks
+framework. Simply add the configuration to your `.pre-commit-config.yaml`:
+
+```yaml
+- repo: https://github.com/jorisroovers/gitlint
+ rev: # Fill in a tag / sha here
+ hooks:
+ - id: gitlint
+```
+
+
## Using gitlint in a CI environment ##
By default, when just running ```gitlint``` without additional parameters, gitlint lint the last commit in the current
git repository.