mm/tools/check_format.sh
rylieb 57a9fb7b34
Hopefully prevent misformatted files from ever entering master again. (#356)
* Added tools/check_format.sh.

* Exit nonzero from format.sh if clang-format-11 not installed.

* Replace which with command -v.

* Fail check_format.sh if format.sh fails.

* Improve Jenkinsfile.

* Take exit 0 out of else in check_format.sh.

* Format flg_set.c to test new Jenkins environment.

* Fix formatter failed logic in check_format.sh.

* Format all misformatted files in master.

* Remove Summarize Problems stage from Jenkins.
I didn't realize Jenkins would not a run a subsequent stage if a
previous stage errored. This defeats the purpose of summarizing all
problems at the end, since this will only happen if there *are* no
problems.

* Use Post->Failure block to print all logs instead.

* Remove spurious semicolon in arms_hook.
2021-10-24 13:06:46 -04:00

24 lines
499 B
Bash
Executable File

#!/bin/bash
STATUSOLD=`git status --porcelain`
./format.sh
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 ./format.sh 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