check_code_style.sh 329 字节
Newer Older
J
jiangjiajun 已提交
1 2
#!/bin/bash
function abort(){
J
test  
jiangjiajun 已提交
3
    echo "Your change doesn't follow X2Paddle's code style." 1>&2
J
jiangjiajun 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    echo "Please use pre-commit to check what is wrong." 1>&2
    exit 1
}

trap 'abort' 0
set -e
cd $TRAVIS_BUILD_DIR
export PATH=/usr/bin:$PATH
pre-commit install

if ! pre-commit run -a ; then
    git diff
    exit 1
fi

trap : 0