pre-commit-job.sh 354 字节
Newer Older
朔-望's avatar
朔-望 已提交
1 2
#!/bin/bash
function abort(){
3
    echo "Your change doesn't follow Paddle-Moible's code style" 1>&2
朔-望's avatar
朔-望 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    echo "Please use pre-commit to auto-format your code." 1>&2
    exit 1
}

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

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

trap : 0