.clang-tidy.hook 350 字节
Newer Older
1
#!/bin/bash
朔-望's avatar
朔-望 已提交
2
set -e
3 4 5 6

TOTAL_ERRORS=0

# The trick to remove deleted files: https://stackoverflow.com/a/2413151
朔-望's avatar
朔-望 已提交
7 8 9
for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}' | grep "src" | grep -v ".pb."); do
    echo "clang-tidy formating $file" 
    clang-tidy $file 
10 11 12 13
    TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?);
done

exit $TOTAL_ERRORS