Print git-diff when pre-commit fails 97/90397/2
authorThanh Ha <zxiiro@gmail.com>
Thu, 11 Jun 2020 14:13:02 +0000 (10:13 -0400)
committerJamo Luhrsen <jluhrsen@gmail.com>
Fri, 26 Jun 2020 16:47:47 +0000 (16:47 +0000)
When pre-commit fails and automatically fixes issues for us in Jenkins
we are not able to see what pre-commit automatically fixed. Adding
--show-diff-on-failure makes pre-commit perform a git-diff immediately
after failing to ensure more useful output is printed to inform the
contributor what changes are needed to pass the check.

Change-Id: I7d97b823e401bb737564a3936afa08085dcb6975
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
tox.ini

diff --git a/tox.ini b/tox.ini
index 4bc566f0a4ea17a0bdc30a82219e341a93955ceb..3f6f9e273b20285db7b46e6c694c9c087874c46d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -15,5 +15,5 @@ basepython = python3
 deps = pre-commit
 commands =
     pre-commit install --hook-type commit-msg
-    pre-commit run --all-files
+    pre-commit run --all-files --show-diff-on-failure
     pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG