Simple bash script to validate no code format violation

Originally written by Ed Tanous in sdbusplus repo

Change-Id: Ifca9862472d0c2d813e54af6dceddc3de244e5a3
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
new file mode 100644
index 0000000..b7db2da
--- /dev/null
+++ b/scripts/format-code.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# This script reformats source files using the clang-format utility.
+#
+# Files are changed in-place, so make sure you don't have anything open in an
+# editor, and you may want to commit before formatting in case of awryness.
+#
+# This must be run on a clean repository to succeed
+#
+# Input parmameter must be full path to git repo to scan
+
+DIR=$1
+cd ${DIR}
+
+echo "Formatting code under $DIR/"
+find . -regextype sed -regex ".*\.[hc]\(pp\)\?" -not -name "*mako*" -print0 | xargs -0 "clang-format-5.0" -i
+
+git --no-pager diff --exit-code