aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
blob: 5aa265800dedbd6b54deea59f055831d71274650 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

# directories to run against
DIRS="src/core src/cpp test/core test/cpp include"

# file matching patterns to check
GLOB="*.h *.cpp"

# clang format command
CLANG_FORMAT=clang-format-3.6

files=
for dir in $DIRS
do
  for glob in $GLOB
  do
    files="$files `find /local-code/$dir -name $glob`"
  done
done

if [ "x$TEST" = "x" ]
then
  echo $files | xargs $CLANG_FORMAT -i
else
  for file in $files
  do
    $CLANG_FORMAT $file | diff $file -
  done
fi