cpplint_pre_commit.hook 700 字节
Newer Older
Y
Yi Wang 已提交
1 2 3 4 5 6
#!/bin/bash

TOTAL_ERRORS=0

# The trick to remove deleted files: https://stackoverflow.com/a/2413151
for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}'); do
M
minqiyang 已提交
7
    if [[ $file =~ ^(paddle/legacy/api/.*|paddle/legacy/capi/.*|paddle/contrib/.*|paddle/legacy/cuda/.*|paddle/legacy/function/.*|paddle/legacy/gserver/.*|paddle/legacy/math/.*|paddle/legacy/optimizer/.*|paddle/legacy/parameter/.*|paddle/legacy/pserver/.*|paddle/legacy/trainer/.*|paddle/legacy/utils/.*|paddle/testing/TestUtil.*|patches/grpc/.*) ]]; then
W
Wu Yi 已提交
8 9
        continue;
    else
10
        cpplint --filter=-readability/fn_size $file;
W
Wu Yi 已提交
11 12
        TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?);
    fi
Y
Yi Wang 已提交
13 14 15 16
done

exit $TOTAL_ERRORS