diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 365f6800bea83b187b2e98175a029501bcaecd42..7aa85ab137ed83da11e317b020d577f76588cc4c 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -270,20 +270,26 @@ function check_style() { eval "$(GIMME_GO_VERSION=1.8.3 gimme)" fi - pip install cpplint + pip install cpplint pylint pytest astroid isort # set up go environment for running gometalinter mkdir -p $GOPATH/src/github.com/PaddlePaddle/ ln -sf ${PADDLE_ROOT} $GOPATH/src/github.com/PaddlePaddle/Paddle - export PATH=/usr/bin:$PATH pre-commit install clang-format --version - if ! pre-commit run -a ; then - git diff + commit_files=on + for file_name in `git diff --numstat upstream/$BRANCH |awk '{print $NF}'`;do + if ! pre-commit run --files $file_name ; then + git diff + commit_files=off + fi + done + + if [ $commit_files == 'off' ];then + echo "code format error" exit 1 fi - trap : 0 } @@ -1133,6 +1139,7 @@ function main() { build ${parallel_number} ;; build_and_check) + check_style generate_upstream_develop_api_spec ${PYTHON_ABI:-""} ${parallel_number} cmake_gen ${PYTHON_ABI:-""} build ${parallel_number}