summaryrefslogtreecommitdiff
path: root/tools/check_format.sh
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-04-01 20:32:16 -0300
committerGitHub <noreply@github.com>2023-04-01 20:32:16 -0300
commit78b87b21fbc11bd50c317e273604ad575ebb5f85 (patch)
tree510a5e49a0cf7e31ed959593c619a71d1b414b4c /tools/check_format.sh
parentd66a21685f45d130f980e8a5ec7b08cfe189e40b (diff)
Jenkins CI (#8)
* Jenkinsfile * Fix format path * I have the stupid * Change CC_CHECK to gcc * Update Makefile Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> --------- Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Diffstat (limited to 'tools/check_format.sh')
-rwxr-xr-xtools/check_format.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/check_format.sh b/tools/check_format.sh
new file mode 100755
index 0000000..e614db6
--- /dev/null
+++ b/tools/check_format.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+STATUSOLD=`git status --porcelain`
+./tools/format.py -j
+if [ $? -ne 0 ]
+then
+ echo "Formatter failed. Exiting."
+ exit -1
+fi
+STATUSNEW=`git status --porcelain`
+
+if [ "${STATUSOLD}" != "${STATUSNEW}" ];
+then
+ echo ""
+ echo "Misformatted files found. Run ./tools/format.py and verify codegen is not impacted."
+ echo ""
+ diff --unified=0 --label "Old git status" <(echo "${STATUSOLD}") --label "New git status" <(echo "${STATUSNEW}")
+ echo ""
+ echo "Exiting."
+ exit 1
+fi
+
+exit 0