Fail format.sh if yapf/flake8 versions are incorrect. (#5083)

This commit is contained in:
Robert Nishihara 2019-07-04 23:22:01 -07:00 committed by GitHub
parent 54d5969cea
commit 9cc4cc6a52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 3 deletions

View file

@ -38,7 +38,6 @@ matrix:
env: LINT=1 PYTHONWARNINGS=ignore
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq clang-format-6.0
install: []
script:
- ./ci/travis/check-git-clang-format-output.sh

View file

@ -22,6 +22,29 @@ if ! [[ -e "$ROOT/.git/refs/remotes/upstream" ]]; then
git remote add 'upstream' 'https://github.com/ray-project/ray.git'
fi
FLAKE8_VERSION=$(flake8 --version | awk '{print $1}')
YAPF_VERSION=$(yapf --version | awk '{print $2}')
if [[ $FLAKE8_VERSION != "3.7.7" ]]; then
echo "Please install flake8==3.7.7. You currently are using $FLAKE8_VERSION."
exit 1
fi
if [[ $YAPF_VERSION != "0.23.0" ]]; then
echo "Please install yapf==0.23.0. You currently are using $YAPF_VERSION."
exit 1
fi
if which clang-format >/dev/null; then
CLANG_FORMAT_VERSION=$(clang-format --version | awk '{print $3}')
if [[ $CLANG_FORMAT_VERSION != "7.0.0" ]]; then
echo "Please install clang-format 7.0.0. You currently are using $CLANG_FORMAT_VERSION."
exit 1
fi
else
echo "WARNING: clang-format is not installed!"
fi
# Only fetch master since that's the branch we're diffing against.
git fetch upstream master || true

View file

@ -57,7 +57,7 @@ elif [[ "$LINT" == "1" ]]; then
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
# Install Python linting tools.
pip install -q flake8 flake8-comprehensions
pip install -q flake8==3.7.7 flake8-comprehensions
pip install flake8-quotes==2.0.0
elif [[ "$LINUX_WHEELS" == "1" ]]; then
sudo apt-get install docker

View file

@ -1,4 +1,4 @@
flake8
flake8==3.7.7
flake8-quotes
gym
opencv-python