diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2018-09-25 00:10:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 00:10:15 -0700 |
commit | a4f57cf49a4533cbc6e21c5eb6d964eda6898bda (patch) | |
tree | 06d264f0b035b73c1269e03fba8b739f8d19221c /ci/test_format.sh | |
parent | 90943525c5d1fa4362cbc5c4b313dab761c02295 (diff) | |
parent | b19266a3e3fda6ff9c97b2c1655ef5e7b4444c46 (diff) | |
download | googletest-a4f57cf49a4533cbc6e21c5eb6d964eda6898bda.tar.gz googletest-a4f57cf49a4533cbc6e21c5eb6d964eda6898bda.tar.bz2 googletest-a4f57cf49a4533cbc6e21c5eb6d964eda6898bda.zip |
Merge branch 'master' into python3-tests
Diffstat (limited to 'ci/test_format.sh')
-rwxr-xr-x | ci/test_format.sh | 33 |
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 |