mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
parent
8da558f5b7
commit
32b9a4d3f1
2 changed files with 12 additions and 13 deletions
|
@ -19,24 +19,23 @@ git fetch upstream master
|
|||
|
||||
YAPF_FLAGS=(
|
||||
'--style' "$ROOT/.style.yapf"
|
||||
'--in-place'
|
||||
'--recursive'
|
||||
'--parallel'
|
||||
)
|
||||
|
||||
YAPF_EXCLUDES=(
|
||||
'--exclude' 'python/ray/dataframe'
|
||||
'--exclude' 'python/ray/rllib'
|
||||
'--exclude' 'python/ray/cloudpickle'
|
||||
'--exclude' 'python/build'
|
||||
'--exclude' 'python/ray/pyarrow_files'
|
||||
'--exclude' 'python/ray/core/src/ray/gcs'
|
||||
'--exclude' 'python/ray/common/thirdparty'
|
||||
'--exclude' 'python/ray/dataframe/*'
|
||||
'--exclude' 'python/ray/rllib/*'
|
||||
'--exclude' 'python/ray/cloudpickle/*'
|
||||
'--exclude' 'python/build/*'
|
||||
'--exclude' 'python/ray/pyarrow_files/*'
|
||||
'--exclude' 'python/ray/core/src/ray/gcs/*'
|
||||
'--exclude' 'python/ray/common/thirdparty/*'
|
||||
)
|
||||
|
||||
# Format specified files
|
||||
format() {
|
||||
yapf "${YAPF_FLAGS[@]}" -- "$@"
|
||||
yapf --in-place "${YAPF_FLAGS[@]}" -- "$@"
|
||||
}
|
||||
|
||||
# Format files that differ from main branch. Ignores dirs that are not slated
|
||||
|
@ -52,13 +51,13 @@ format_changed() {
|
|||
|
||||
if ! git diff --diff-filter=ACM --quiet --exit-code "$MERGEBASE" -- '*.py' &>/dev/null; then
|
||||
declare -a unformatted_files && mapfile -t unformatted_files < <(git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.py')
|
||||
yapf "${YAPF_EXCLUDES[@]}" "${YAPF_FLAGS[@]}" -- "${unformatted_files[@]}"
|
||||
yapf --in-place "${YAPF_EXCLUDES[@]}" "${YAPF_FLAGS[@]}" -- "${unformatted_files[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Format all files
|
||||
# Format all files, and print the diff to stdout for travis.
|
||||
format_all() {
|
||||
yapf "${YAPF_FLAGS[@]}" "${YAPF_EXCLUDES[@]}" test python
|
||||
yapf --diff "${YAPF_FLAGS[@]}" "${YAPF_EXCLUDES[@]}" test python
|
||||
}
|
||||
|
||||
# This flag formats individual files. --files *must* be the first command line
|
||||
|
|
|
@ -56,7 +56,7 @@ helpful.
|
|||
|
||||
5. **Autoformatting code**. We use ``yapf`` https://github.com/google/yapf for
|
||||
linting, and the config file is located at ``.style.yapf``. We recommend
|
||||
running ``.travis/yapf.sh`` prior to pushing to format changed files.
|
||||
running ``scripts/yapf.sh`` prior to pushing to format changed files.
|
||||
Note that some projects such as dataframes and rllib are currently excluded.
|
||||
|
||||
6. **Inspecting Redis shards by hand:** To inspect the primary Redis shard by
|
||||
|
|
Loading…
Add table
Reference in a new issue