Replace coala commit-msg hook with pre-commit 45/15145/2 v0.3.0
authorThanh Ha <zxiiro@gmail.com>
Sun, 31 Mar 2019 01:14:18 +0000 (21:14 -0400)
committerThanh Ha <zxiiro@gmail.com>
Fri, 12 Apr 2019 05:51:41 +0000 (13:51 +0800)
Idea here is to replace the slow coala checker with the
much faster pre-commit hooks in the future as we replace
the different linters we're using via coala with pre-commit
versions.

Using this requires the developer to setup pre-commit on their
local dev environment to initialize this the first time the
contribute to this repo.

Install can be performed via one of the following methods:

1) Install pre-commit from your local package manager then run:

    pre-commit install --hook-type commit-msg

2) Run `tox -e check-hooks`

Change-Id: I5b5d3dcbd7d83e90322f63ba99fa1f76c88ee8ad
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
.coafile
.pre-commit-config.yaml
tox.ini

index 8a2fa26..edba4bd 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -10,14 +10,6 @@ ignore = .tox/**,
 bears = WriteGoodLintBear
 files = docs/**.rst
 
-[all.Git]
-bears = GitCommitBear
-ignore_length_regex = Signed-off-by,
-    Also-by,
-    Co-authored-by,
-    http://,
-    https://
-
 [all.Python]
 bears = BanditBear,
     PEP8Bear,
index ce05348..c52b437 100644 (file)
@@ -4,3 +4,9 @@ repos:
     rev: v1.3.0
     hooks:
       - id: trailing-whitespace
+
+  - repo: https://github.com/jorisroovers/gitlint
+    rev: v0.11.0
+    hooks:
+    -   id: gitlint
+
diff --git a/tox.ini b/tox.ini
index ab77912..2550e36 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -13,12 +13,6 @@ deps =
 commands =
     pytest --basetemp={envtmpdir} {posargs}
 
-[testenv:check-hooks]
-deps = pre-commit
-commands =
-    pre-commit install
-    pre-commit run --all-files
-
 [testenv:coala]
 basepython = python3
 deps =
@@ -43,6 +37,11 @@ deps = -rdocs/requirements.txt
 commands =
     sphinx-build -j auto --keep-going -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
 
+[testenv:pre-commit]
+deps = pre-commit
+commands =
+    pre-commit install --hook-type commit-msg
+    pre-commit run --all-files
 
 [testenv:reno]
 deps = -rdocs/requirements.txt