• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2
3CLANG_FORMAT="clang-format-7"
4if [ -z "$(which $CLANG_FORMAT)" ]; then
5  CLANG_FORMAT="clang-format"
6fi
7
8for f in $(ls *.cc *.h); do
9  if ! diff -U 1 <($CLANG_FORMAT $f) $f; then
10    echo
11    echo "!!!!!!"
12    echo "!! Failed clang-format check, please run 'clang-format -i *.cc *.h'" 1>&2
13    echo "!!!!!!"
14    exit 1
15  fi
16done
17