Print git-diff when pre-commit fails 27/64227/1
authorThanh Ha <zxiiro@gmail.com>
Sat, 6 Jun 2020 14:07:50 +0000 (10:07 -0400)
committerThanh Ha <zxiiro@gmail.com>
Sat, 6 Jun 2020 14:08:00 +0000 (10:08 -0400)
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: I5553c09d6079a71d64eebf3058e0cdec5fdf6b4f
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
tox.ini

diff --git a/tox.ini b/tox.ini
index aacc8d4..8147f78 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -46,7 +46,7 @@ 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
 
 [testenv:reno]
 basepython = python3