Skip to content

Commit

Permalink
Bug 1293528 - Config for running clang-format on gtests, r=franziskus
Browse files Browse the repository at this point in the history
--HG--
extra : rebase_source : 6e68f15cdfaef6a211c316b92dbcf61cac9fb14b
extra : amend_source : d7ab13e3670ee31b10e461f17f12e275cbadab6f
  • Loading branch information
martinthomson committed Aug 15, 2016
1 parent 7b0c3b9 commit e5992fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 14 additions & 1 deletion automation/taskcluster/scripts/run_clang_format.sh
Expand Up @@ -13,20 +13,33 @@ fi

# Includes a default set of directories.

apply=false
if [ $1 = "--apply" ]; then
apply=true
shift
fi

if [ $# -gt 0 ]; then
dirs=("$@")
else
top=$(dirname $0)/../../..
dirs=( \
"$top/lib/ssl" \
"$top/lib/softoken" \
"$top/external_tests/common" \
"$top/external_tests/der_gtest" \
"$top/external_tests/pk11_gtest" \
"$top/external_tests/ssl_gtest" \
"$top/external_tests/util_gtest" \
)
fi

STATUS=0
for dir in "${dirs[@]}"; do
for i in $(find "$dir" -type f \( -name '*.[ch]' -o -name '*.cc' \) -print); do
if ! clang-format "$i" | diff -Naur "$i" -; then
if $apply; then
clang-format -i "$i"
elif ! clang-format "$i" | diff -Naur "$i" -; then
echo "Sorry, $i is not formatted properly. Please use clang-format 3.8 on your patch before landing."
STATUS=1
fi
Expand Down
4 changes: 4 additions & 0 deletions external_tests/.clang-format
@@ -0,0 +1,4 @@
---
Language: Cpp
BasedOnStyle: Google
...

0 comments on commit e5992fc

Please sign in to comment.