Skip to content

Commit

Permalink
Support clang-format whose version is not 7.0 (#5139)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangzihao2009 authored and raulchen committed Jul 8, 2019
1 parent 7ad854d commit b4e51c8
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions ci/travis/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@ 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
# params: tool name, tool version, required version
tool_version_check() {
if [[ $2 != $3 ]]; then
echo "WARNING: Ray uses $1 $3, You currently are using $2. This might generate different results."
read -p "Do you want to continue?[y/n]" answer
if ! [ $answer = 'y' ] && ! [ $answer = 'Y' ]; then
exit 1
fi
fi
}

if [[ $YAPF_VERSION != "0.23.0" ]]; then
echo "Please install yapf==0.23.0. You currently are using $YAPF_VERSION."
exit 1
fi
tool_version_check "flake8" $FLAKE8_VERSION "3.7.7"
tool_version_check "yapf" $YAPF_VERSION "0.23.0"

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
tool_version_check "clang-format" $CLANG_FORMAT_VERSION "7.0.0"
else
echo "WARNING: clang-format is not installed!"
echo "WARNING: clang-format is not installed!"
fi

# Only fetch master since that's the branch we're diffing against.
Expand Down

0 comments on commit b4e51c8

Please sign in to comment.