aboutsummaryrefslogtreecommitdiffstats
path: root/ci/test_format.sh
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-09-25 02:55:08 -0400
committerGennadiy Civil <misterg@google.com>2018-09-25 02:55:08 -0400
commit76e1045729e2cb0c2050dec056cba5eccd7d9ca5 (patch)
treece26f795bd7393fad4af2e4002e5d65709b4dda1 /ci/test_format.sh
parent2d3466be4785560cfc93680e28f9afb92e656665 (diff)
downloadgoogletest-76e1045729e2cb0c2050dec056cba5eccd7d9ca5.tar.gz
googletest-76e1045729e2cb0c2050dec056cba5eccd7d9ca5.tar.bz2
googletest-76e1045729e2cb0c2050dec056cba5eccd7d9ca5.zip
typo
Diffstat (limited to 'ci/test_format.sh')
-rwxr-xr-xci/test_format.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/ci/test_format.sh b/ci/test_format.sh
new file mode 100755
index 00000000..502c84c5
--- /dev/null
+++ b/ci/test_format.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+echo "clang-format - checking Code Formatting..."
+
+if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && \
+ [[ "${TEST_CLANG_FORMAT}" == "yes" ]]; then
+
+ RETURN=0
+ CLANG_FORMAT="clang-format-3.9"
+
+ which clang-format-3.9
+
+ if [ ! -f ".clang-format" ]; then
+ echo ".clang-format file not found!"
+ exit 1
+ fi
+
+ FILES=`git diff master --name-only | grep -E "\.(cc|cpp|h)$"`
+
+ for FILE in $FILES; do
+
+ $CLANG_FORMAT $FILE | cmp $FILE >/dev/null
+
+ if [ $? -ne 0 ]; then
+ echo "[!] Clang-Format Found INCORRECT FORMATTING. Please re-format and re-submit. The following file failed: $FILE" >&2
+ RETURN=1
+ fi
+
+ done
+
+ exit $RETURN
+fi
+
+exit 0