Add pre-commit hook for trailing-whitespace 34/11834/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 18 Jul 2018 01:28:53 +0000 (21:28 -0400)
committerThanh Ha <zxiiro@linux.com>
Wed, 18 Jul 2018 01:34:22 +0000 (21:34 -0400)
Install using tox:

    tox -e check-hooks

ref: https://pre-commit.com

Change-Id: I80ac7933ee3d350c3d3d860e190b8348efd701e1
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.pre-commit-config.yaml [new file with mode: 0644]
tox.ini

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..ce05348
--- /dev/null
@@ -0,0 +1,6 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v1.3.0
+    hooks:
+      - id: trailing-whitespace
diff --git a/tox.ini b/tox.ini
index 89f4b04..006b2b6 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,7 @@
 [tox]
 minversion = 1.6
 envlist =
+    check-hooks,
     coala,
     docs,
     docs-linkcheck,
@@ -11,6 +12,12 @@ deps = -rrequirements.txt
 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 =