ray/.travis/yapf.sh

30 lines
692 B
Bash
Raw Normal View History

2018-04-11 10:11:35 -07:00
#!/usr/bin/env bash
# Cause the script to exit if a single command fails
set -eo pipefail
2018-04-11 10:11:35 -07:00
# this stops git rev-parse from failing if we run this from the .git directory
builtin cd "$(dirname "${BASH_SOURCE:-$0}")"
2018-04-11 10:11:35 -07:00
ROOT="$(git rev-parse --show-toplevel)"
builtin cd "$ROOT"
2018-04-11 10:11:35 -07:00
yapf \
--style "$ROOT/.style.yapf" \
--in-place --recursive --parallel \
--exclude 'python/ray/cloudpickle' \
--exclude 'python/ray/dataframe' \
--exclude 'python/ray/rllib' \
-- \
'test' 'python'
2018-04-11 10:11:35 -07:00
if ! git diff --quiet; then
echo 'Reformatted staged files. Please review and stage the changes.'
echo 'Files updated:'
echo
git --no-pager diff --name-only
exit 1
2018-04-11 10:11:35 -07:00
fi