Add pre-commit hook for trailing-whitespace 77/11477/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 21 Jun 2018 00:25:44 +0000 (20:25 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 21 Jun 2018 00:32:36 +0000 (20:32 -0400)
Install using tox:

    tox -e check-hooks

ref: https://pre-commit.com

Change-Id: Ie060a9d1c843ce3889df10535d0a87e41d4b4e76
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 2d4d91e..c5578f7 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,8 +1,14 @@
 [tox]
 minversion = 1.6
-envlist = coala,jjb,jjb-compare-xml,license
+envlist = check-hooks,coala,jjb,jjb-compare-xml,license
 skipsdist = true
 
+[testenv:check-hooks]
+deps = pre-commit
+commands =
+    pre-commit install
+    pre-commit run --all-files
+
 [testenv:coala]
 basepython = python3
 deps =