Switch to using pre-commit instead of coala 27/82427/3
authorThanh Ha <zxiiro@gmail.com>
Thu, 6 Jun 2019 21:18:55 +0000 (17:18 -0400)
committerThanh Ha <zxiiro@gmail.com>
Thu, 6 Jun 2019 21:27:35 +0000 (17:27 -0400)
The Coala linter for GitCommit Hooks requires the Python NLTK
library which in the past couple of days started depending on
numpy. Let's switch to pre-commit so that we don't have to pull
in numpy.

Change-Id: Ic13381bccaf6e113f9e617b8ed840624b769e47b
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
.coafile
.pre-commit-config.yaml [new file with mode: 0644]
tox.ini

index 1530ff1de1d8946cd31414d9999126b94a8432d2..44e0860adbf53400ecff3f19b9d1ffa2f1aba92c 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -4,24 +4,8 @@ ignore = .**,
     **/target/**,
     **/thrift/**,
 
-[all.GitCommit]
-bears = GitCommitBear
-ignore_length_regex = Signed-off-by,
-    Also-by,
-    Co-authored-by,
-    http://,
-    https://
-
 [all.reStructuredText]
 bears = RSTcheckBear
 files = **.rst
 ignore = .**
 enabled = False
-
-[all.Spacing]
-bears = SpaceConsistencyBear
-files = **/*.java
-use_spaces = True
-allow_trailing_whitespace = False
-enforce_newline_at_EOF = True
-default_actions = SpaceConsistencyBear: ApplyPatchAction
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..c52b437
--- /dev/null
@@ -0,0 +1,12 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    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 9ef083e45b26ec7de352d1dabd108d123ccfd0d2..f15d569b4d40b283924b8213881279ca33342680 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 minversion = 1.6.0
-envlist = coala,docs
+envlist = coala,docs,pre-commit
 skipsdist = true
 
 [testenv:coala]
@@ -11,10 +11,15 @@ deps =
     pygments~=2.3.1
     requests~=2.21.0
 commands =
-    python3 -m nltk.downloader punkt maxent_treebank_pos_tagger averaged_perceptron_tagger
     coala --non-interactive
 
 [testenv:docs]
 deps = -rdocs/requirements.txt
 commands =
     sphinx-build -W -n -b html -d {envtmpdir}/doctrees ./docs/ {envtmpdir}/html
+
+[testenv:pre-commit]
+deps = pre-commit
+commands =
+    pre-commit install --hook-type commit-msg
+    pre-commit run --all-files