aboutsummaryrefslogtreecommitdiff
path: root/clang-format-check
blob: acbf3ce1a2a92b5b237491921aa5f1fcbdf05eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env bash

if [ -z "$CLANG_FORMAT" ]; then
  CLANG_FORMAT="clang-format"
fi

for f in $(ls src/*.cc src/*.h); do
  if ! diff -U 1 <($CLANG_FORMAT $f) $f; then
    echo
    echo "!!!!!!"
    echo "!! Failed clang-format check, please run 'clang-format -i src/*.cc src/*.h'" 1>&2
    echo "!!!!!!"
    exit 1
  fi
done