Skip to content

Add shellcheck support#8574

Merged
edoakes merged 33 commits intoray-project:masterfrom
mehrdadn:shellcheck
Jul 30, 2020
Merged

Add shellcheck support#8574
edoakes merged 33 commits intoray-project:masterfrom
mehrdadn:shellcheck

Conversation

@mehrdadn
Copy link
Copy Markdown
Contributor

@mehrdadn mehrdadn commented May 23, 2020

Why are these changes needed?

Checks shell scripts for common errors.

Related issue number

#631

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/latest/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failure rates at https://ray-travis-tracker.herokuapp.com/.
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested (please justify below)

@mehrdadn mehrdadn force-pushed the shellcheck branch 5 times, most recently from c937d73 to f8c4455 Compare May 26, 2020 11:48
@simon-mo simon-mo self-requested a review June 1, 2020 20:59
@simon-mo
Copy link
Copy Markdown
Contributor

simon-mo commented Jun 2, 2020

can you post the result of the running this script on latest master here as well?

@mehrdadn
Copy link
Copy Markdown
Contributor Author

mehrdadn commented Jun 6, 2020

@simon-mo Here's the output on latest master. Note that fixing these isn't just as trivial as making the proposed changes, since the semantics can be different.

Output
In build-docker.sh line 55:
    echo "$IMAGE_SHA" | sed 's/sha256://'
    ^-- SC2001: See if you can use ${variable//search/replace} instead.


In build.sh line 35:
  PARALLEL="${NUMBER_OF_PROCESSORS-1}"
  ^------^ SC2034: PARALLEL appears unused. Verify use (or export if used externally).


In build.sh line 66:
        exit -1
             ^-- SC2242: Can only exit with status 0-255. Other data should be written to stdout/stderr.


In build.sh line 78:
      exit -1
           ^-- SC2242: Can only exit with status 0-255. Other data should be written to stdout/stderr.


In build.sh line 88:
PYTHON_VERSION=`"$PYTHON_EXECUTABLE" -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))'`
               ^-- SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
PYTHON_VERSION=$("$PYTHON_EXECUTABLE" -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))')


In build.sh line 90:
for allowed in ${SUPPORTED_PYTHONS[@]}
               ^---------------------^ SC2068: Double quote array expansions to avoid re-splitting elements.


In build.sh line 92:
  if [[ "$PYTHON_VERSION" == $allowed ]]
                             ^------^ SC2053: Quote the right-hand side of == in [[ ]] to prevent glob matching.


In build.sh line 131:
  "$BAZEL_EXECUTABLE" build ${ENABLE_ASAN-} //java:ray_java_pkg --verbose_failures
                            ^-------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  "$BAZEL_EXECUTABLE" build "${ENABLE_ASAN-}" //java:ray_java_pkg --verbose_failures


In build.sh line 163:
  "$BAZEL_EXECUTABLE" build ${ENABLE_ASAN-} //:ray_pkg --verbose_failures
                            ^-------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  "$BAZEL_EXECUTABLE" build "${ENABLE_ASAN-}" //:ray_pkg --verbose_failures


In ci/jenkins_tests/entry_point.sh line 15:
SUPPRESS_OUTPUT=$ROOT_DIR/../suppress_output
^-------------^ SC2034: SUPPRESS_OUTPUT appears unused. Verify use (or export if used externally).


In ci/jenkins_tests/entry_point.sh line 22:
    "$@" && break || {
         ^-- SC2015: Note that A && B || C is not if-then-else. C may run when A is true.


In ci/jenkins_tests/entry_point.sh line 34:
if [[ ! -z "$RUN_TUNE_TESTS" ]]; then
      ^-- SC2236: Use -n instead of ! -z.


In ci/jenkins_tests/entry_point.sh line 35:
    retry bash $ROOT_DIR/run_tune_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    retry bash "$ROOT_DIR"/run_tune_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}


In ci/jenkins_tests/entry_point.sh line 38:
if [[ ! -z "$RUN_DOC_TESTS" ]]; then
      ^-- SC2236: Use -n instead of ! -z.


In ci/jenkins_tests/entry_point.sh line 39:
    retry bash $ROOT_DIR/run_doc_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    retry bash "$ROOT_DIR"/run_doc_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}


In ci/jenkins_tests/entry_point.sh line 42:
if [[ ! -z "$RUN_SGD_TESTS" ]]; then
      ^-- SC2236: Use -n instead of ! -z.


In ci/jenkins_tests/entry_point.sh line 43:
    retry bash $ROOT_DIR/run_sgd_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    retry bash "$ROOT_DIR"/run_sgd_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}


In ci/jenkins_tests/run_doc_tests.sh line 28:
    git archive -o ./docker/tune_test/ray.tar $(git rev-parse HEAD)
                                              ^-------------------^ SC2046: Quote this to prevent word splitting.


In ci/jenkins_tests/run_doc_tests.sh line 36:
echo "Using Docker image" $DOCKER_SHA
                          ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
echo "Using Docker image" "$DOCKER_SHA"


In ci/jenkins_tests/run_doc_tests.sh line 41:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_doc_tests.sh line 44:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_doc_tests.sh line 47:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_doc_tests.sh line 50:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_doc_tests.sh line 53:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_multi_node_tests.sh line 1:
# This file exists for Jenkins compatiblity
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In ci/jenkins_tests/run_multi_node_tests.sh line 3:
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
           ^-- SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

Did you mean:
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")" || exit; pwd)


In ci/jenkins_tests/run_multi_node_tests.sh line 10:
bash $ROOT_DIR/entry_point.sh
     ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
bash "$ROOT_DIR"/entry_point.sh


In ci/jenkins_tests/run_sgd_tests.sh line 28:
    git archive -o ./docker/tune_test/ray.tar $(git rev-parse HEAD)
                                              ^-------------------^ SC2046: Quote this to prevent word splitting.


In ci/jenkins_tests/run_sgd_tests.sh line 36:
echo "Using Docker image" $DOCKER_SHA
                          ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
echo "Using Docker image" "$DOCKER_SHA"


In ci/jenkins_tests/run_sgd_tests.sh line 41:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 44:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 48:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 51:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 54:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 57:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 60:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 63:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 66:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 69:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 72:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 75:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 78:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 81:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 84:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 87:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 90:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_sgd_tests.sh line 93:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 28:
    git archive -o ./docker/tune_test/ray.tar $(git rev-parse HEAD)
                                              ^-------------------^ SC2046: Quote this to prevent word splitting.


In ci/jenkins_tests/run_tune_tests.sh line 37:
echo "Using Docker image" $DOCKER_SHA
                          ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
echo "Using Docker image" "$DOCKER_SHA"


In ci/jenkins_tests/run_tune_tests.sh line 41:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 44:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 47:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 50:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 53:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 56:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 59:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 -e MPLBACKEND=Agg $DOCKER_SHA \
                                                                                                                   ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 -e MPLBACKEND=Agg "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 62:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 66:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 69:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 73:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 76:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 79:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 82:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 86:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 89:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 93:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 104:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 108:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 112:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 115:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 119:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 123:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 127:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 131:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 140:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 144:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 149:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/jenkins_tests/run_tune_tests.sh line 153:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
                                                                                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \


In ci/regression_test/rllib_stress_tests/run.sh line 1:

^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In ci/travis/bazel-format.sh line 20:
RUN_TYPE=diff
^------^ SC2209: Use var=$(command) to assign output (or quote to assign string).


In ci/travis/bazel-format.sh line 23:
while [[ $# > 0 ]]; do
            ^-- SC2071: > is for string comparisons. Use -gt instead.


In ci/travis/bazel-format.sh line 31:
      RUN_TYPE=diff
      ^------^ SC2209: Use var=$(command) to assign output (or quote to assign string).


In ci/travis/bazel-format.sh line 40:
      exit -1
           ^-- SC2242: Can only exit with status 0-255. Other data should be written to stdout/stderr.


In ci/travis/bazel-format.sh line 46:
pushd $ROOT_DIR/../..
      ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
pushd "$ROOT_DIR"/../..


In ci/travis/bazel-format.sh line 49:
buildifier -mode=$RUN_TYPE -diff_command="diff -u" $BAZEL_FILES
                                                   ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
buildifier -mode=$RUN_TYPE -diff_command="diff -u" "$BAZEL_FILES"


In ci/travis/build-autoscaler-images.sh line 1:
# This script build docker images for autoscaler.
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In ci/travis/build-autoscaler-images.sh line 7:
ROOT_DIR=$(cd $SCRIPT_DIR/../../; pwd)
              ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
ROOT_DIR=$(cd "$SCRIPT_DIR"/../../; pwd)


In ci/travis/build-autoscaler-images.sh line 16:
    wheel=$(cd $ROOT_DIR/.whl; ls | grep cp36m-manylinux)
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                               ^-- SC2010: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

Did you mean:
    wheel=$(cd "$ROOT_DIR"/.whl; ls | grep cp36m-manylinux)


In ci/travis/build-autoscaler-images.sh line 17:
    commit_sha=$(echo $TRAVIS_COMMIT | head -c 6)
                      ^------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    commit_sha=$(echo "$TRAVIS_COMMIT" | head -c 6)


In ci/travis/build-autoscaler-images.sh line 18:
    cp -r $ROOT_DIR/.whl $ROOT_DIR/docker/autoscaler/.whl
          ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    cp -r "$ROOT_DIR"/.whl "$ROOT_DIR"/docker/autoscaler/.whl


In ci/travis/build-autoscaler-images.sh line 22:
        --build-arg WHEEL_NAME=$wheel \
                               ^----^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
        --build-arg WHEEL_NAME="$wheel" \


In ci/travis/build-autoscaler-images.sh line 23:
        -t rayproject/autoscaler:$commit_sha \
                                 ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
        -t rayproject/autoscaler:"$commit_sha" \


In ci/travis/build-autoscaler-images.sh line 24:
        $ROOT_DIR/docker/autoscaler
        ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
        "$ROOT_DIR"/docker/autoscaler


In ci/travis/build-autoscaler-images.sh line 25:
    docker push rayproject/autoscaler:$commit_sha
                                      ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    docker push rayproject/autoscaler:"$commit_sha"


In ci/travis/build-autoscaler-images.sh line 30:
       normalized_branch_name=$(echo $TRAVIS_BRANCH | sed -e "s/\//-/")
                                     ^------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
       normalized_branch_name=$(echo "$TRAVIS_BRANCH" | sed -e "s/\//-/")


In ci/travis/build-autoscaler-images.sh line 31:
       docker tag rayproject/autoscaler:$commit_sha rayproject/autoscaler:$normalized_branch_name
                                        ^---------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                          ^---------------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
       docker tag rayproject/autoscaler:"$commit_sha" rayproject/autoscaler:"$normalized_branch_name"


In ci/travis/build-autoscaler-images.sh line 32:
       docker push rayproject/autoscaler:$normalized_branch_name
                                         ^---------------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
       docker push rayproject/autoscaler:"$normalized_branch_name"


In ci/travis/build-autoscaler-images.sh line 34:
       docker tag rayproject/autoscaler:$commit_sha rayproject/autoscaler:latest
                                        ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
       docker tag rayproject/autoscaler:"$commit_sha" rayproject/autoscaler:latest


In ci/travis/ci.sh line 157:
      . "${HOME}/.nvm/nvm.sh"
        ^-------------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.


In ci/travis/ci.sh line 293:
    export PATH="${GOPATH}/bin":"${GOROOT}/bin":"${PATH}"
                               ^-- SC2140: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
                                               ^-- SC2140: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?


In ci/travis/ci.sh line 307:
    . "${HOME}/.nvm/nvm.sh"
      ^-------------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.


In ci/travis/ci.sh line 310:
    node_modules/.bin/eslint --max-warnings 0 $(find src -name "*.ts" -or -name "*.tsx")
                                              ^-- SC2046: Quote this to prevent word splitting.


In ci/travis/ci.sh line 311:
    node_modules/.bin/prettier --check $(find src -name "*.ts" -or -name "*.tsx")
                                       ^-- SC2046: Quote this to prevent word splitting.


In ci/travis/ci.sh line 348:
    ROOT_DIR="${WORKSPACE_DIR}"/ci/travis
    ^------^ SC2030: Modification of ROOT_DIR is local (to subshell caused by (..) group).


In ci/travis/ci.sh line 351:
      . "${ROOT_DIR}"/ci.sh _lint
        ^-----------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.


In ci/travis/ci.sh line 362:
  variable_definitions=($(python "${ROOT_DIR}"/determine_tests_to_run.py))
                        ^-- SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
                                  ^---------^ SC2031: ROOT_DIR was modified in a subshell. That change might be lost.


In ci/travis/ci.sh line 373:
  if ! (set +x && should_run_job ${job_names//,/ }); then
                                 ^---------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  if ! (set +x && should_run_job "${job_names//,/ }"); then


In ci/travis/ci.sh line 414:
  . "${ROOT_DIR}"/install-dependencies.sh  # Script is sourced to propagate up environment changes
    ^-- SC1090: Can't follow non-constant source. Use a directive to specify location.
     ^---------^ SC2031: ROOT_DIR was modified in a subshell. That change might be lost.


In ci/travis/ci.sh line 419:
    bazel build ${ENABLE_ASAN-} -k "//:*"   # Do a full build first to ensure everything passes
                ^-------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    bazel build "${ENABLE_ASAN-}" -k "//:*"   # Do a full build first to ensure everything passes


In ci/travis/format.sh line 24:
    if ! [ -x "$(command -v $1)" ]; then
                            ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    if ! [ -x "$(command -v "$1")" ]; then


In ci/travis/format.sh line 34:
if ! echo $ver | grep -q 0.23.0; then
          ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
if ! echo "$ver" | grep -q 0.23.0; then


In ci/travis/format.sh line 55:
    if [[ $2 != $3 ]]; then
                ^-- SC2053: Quote the right-hand side of != in [[ ]] to prevent glob matching.


In ci/travis/format.sh line 60:
tool_version_check "flake8" $FLAKE8_VERSION $FLAKE8_VERSION_REQUIRED
                            ^-------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
tool_version_check "flake8" "$FLAKE8_VERSION" $FLAKE8_VERSION_REQUIRED


In ci/travis/format.sh line 61:
tool_version_check "yapf" $YAPF_VERSION $YAPF_VERSION_REQUIRED
                          ^-----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
tool_version_check "yapf" "$YAPF_VERSION" $YAPF_VERSION_REQUIRED


In ci/travis/format.sh line 65:
  tool_version_check "clang-format" $CLANG_FORMAT_VERSION "7.0.0"
                                    ^-------------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  tool_version_check "clang-format" "$CLANG_FORMAT_VERSION" "7.0.0"


In ci/travis/install-bazel.sh line 33:
  while read -r mode digest sn path; do
                     ^----^ SC2034: digest appears unused. Verify use (or export if used externally).
                            ^-- SC2034: sn appears unused. Verify use (or export if used externally).


In ci/travis/install-bazel.sh line 39:
    echo "error: expected symlink: ${missing_symlinks[@]}" 1>&2
                                   ^--------------------^ SC2145: Argument mixes string and array. Use * or separate argument.


In ci/travis/install-bazel.sh line 103:
    elif [ -n "${encrypted_1c30b31fe1ee_key:+x}" ]; then
               ^-- SC2154: encrypted_1c30b31fe1ee_key is referenced but not assigned.


In ci/travis/install-bazel.sh line 106:
            -iv "${encrypted_1c30b31fe1ee_iv}" \
                 ^--------------------------^ SC2154: encrypted_1c30b31fe1ee_iv is referenced but not assigned.


In ci/travis/install-bazel.sh line 110:
      if [ 0 -eq $? ]; then
                 ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In ci/travis/install-dependencies.sh line 146:
        'nvm() { "${NVM_HOME}/nvm.exe" "$@"; }' \
        ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.


In ci/travis/install-dependencies.sh line 180:
      . "${HOME}/.nvm/nvm.sh"
        ^-------------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.


In ci/travis/install-dependencies.sh line 236:
    for i in {1..3};
    ^-^ SC2034: i appears unused. Verify use (or export if used externally).


In ci/travis/install-dependencies.sh line 263:
      torch=="${TORCH_VERSION-1.4}" torchvision atari_py gym[atari] lz4 smart_open
                                                            ^-----^ SC2102: Ranges can only match single chars (mentioned due to duplicates).


In ci/travis/iwyu.sh line 61:
      { PATH="${PATH}:/usr/bin" env -i "${env_vars[@]}" "${SHELL-/bin/bash}" -c 'iwyu -isystem "$("$1" -print-resource-dir "${@:2}")/include" "${@:2}"' exec "${args[@]}" 2>&1 || true; } | awk '
                                                                                ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.


In ci/travis/iwyu.sh line 90:
        + [.[1:][] | select (.[0] == 6) | "\(.[1][1])=\(.[2][1])" | gsub("'\''"; "'\''\\'\'''\''") | "'\''\(.)'\''"]
                                                                                       ^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'.


In ci/travis/iwyu.sh line 92:
        + [.[1:][] | select (.[0] == 1) | .[1]                    | gsub("'\''"; "'\''\\'\'''\''") | "'\''\(.)'\''"]
                                                                                       ^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'.


In ci/travis/test-wheels.sh line 28:
    "$@" && break || {
         ^-- SC2015: Note that A && B || C is not if-then-else. C may run when A is true.


In ci/travis/test-wheels.sh line 83:
  NUMBER_OF_WHEELS=$(ls -1q "$ROOT_DIR"/../../.whl/*.whl | wc -l)
                     ^-- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.


In ci/travis/test-wheels.sh line 116:
    INSTALLED_RAY_DIRECTORY=$(dirname "$($PYTHON_EXE -u -c "import ray; print(ray.__file__)" | tail -n1)")
    ^---------------------^ SC2034: INSTALLED_RAY_DIRECTORY appears unused. Verify use (or export if used externally).


In debug.sh line 21:
                        if killall -u "${USER}" -g ${flags} -s "${sig}" python3 ray::IDLE redis-server; then
                                                   ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
                        if killall -u "${USER}" -g "${flags}" -s "${sig}" python3 ray::IDLE redis-server; then


In debug.sh line 81:
        local key; for key in "${!envvars[@]}"; do envvararr+=("${key}"="${envvars[${key}]}"); done
                                                                       ^-- SC2191: The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it.

Did you mean:
        local key; for key in "${!envvars[@]}"; do envvararr+=("${key}""=""${envvars[${key}]}"); done


In doc/azure/azure-init.sh line 10:
sudo -u $USERNAME -i /bin/bash -l -c "conda init bash"
        ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
sudo -u "$USERNAME" -i /bin/bash -l -c "conda init bash"


In doc/azure/azure-init.sh line 11:
sudo -u $USERNAME -i /bin/bash -l -c "conda activate $CONDA_ENV; pip install $WHEEL"
        ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
sudo -u "$USERNAME" -i /bin/bash -l -c "conda activate $CONDA_ENV; pip install $WHEEL"


In doc/azure/azure-init.sh line 14:
cat > /home/$USERNAME/ray-head.sh << EOM
            ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
cat > /home/"$USERNAME"/ray-head.sh << EOM


In doc/azure/azure-init.sh line 25:
cat > /home/$USERNAME/ray-worker.sh << EOM
            ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
cat > /home/"$USERNAME"/ray-worker.sh << EOM


In doc/azure/azure-init.sh line 42:
cat > /home/$USERNAME/tensorboard.sh << EOM
            ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
cat > /home/"$USERNAME"/tensorboard.sh << EOM


In doc/azure/azure-init.sh line 51:
chmod +x /home/$USERNAME/ray-head.sh
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
chmod +x /home/"$USERNAME"/ray-head.sh


In doc/azure/azure-init.sh line 52:
chmod +x /home/$USERNAME/ray-worker.sh
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
chmod +x /home/"$USERNAME"/ray-worker.sh


In doc/azure/azure-init.sh line 53:
chmod +x /home/$USERNAME/tensorboard.sh
               ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
chmod +x /home/"$USERNAME"/tensorboard.sh


In doc/azure/azure-init.sh line 87:
if [ "$type" = "head" ]; then
      ^---^ SC2154: type is referenced but not assigned (for output from commands, use "$(type ...)" ).


In doc/dev/bin/pip_download_test.sh line 1:
# This script automatically download ray and run the sanity check (sanity_check.py)
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In doc/dev/bin/pip_download_test.sh line 26:
source "$(conda info --base)/etc/profile.d/conda.sh"
       ^-- SC1090: Can't follow non-constant source. Use a directive to specify location.


In doc/dev/bin/pip_download_test.sh line 33:
    echo "\n\n\n========================================================="
         ^-- SC2028: echo may not expand escape sequences. Use printf.


In doc/dev/bin/pip_download_test.sh line 37:
    echo "=========================================================\n\n\n"
         ^-- SC2028: echo may not expand escape sequences. Use printf.


In doc/dev/bin/pip_download_test.sh line 46:
    echo "\n\n\n========================================================="
         ^-- SC2028: echo may not expand escape sequences. Use printf.


In doc/dev/bin/pip_download_test.sh line 52:
    echo "=========================================================\n\n\n"
         ^-- SC2028: echo may not expand escape sequences. Use printf.


In doc/dev/bin/pip_download_test.sh line 55:
    conda remove -y --name ${env_name} --all
                           ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    conda remove -y --name "${env_name}" --all


In doc/dev/download_wheels.sh line 1:
if [[ -z "$RAY_HASH" ]]; then
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In doc/dev/download_wheels.sh line 12:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp35-cp35m-manylinux1_x86_64.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp35-cp35m-manylinux1_x86_64.whl


In doc/dev/download_wheels.sh line 13:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp36-cp36m-manylinux1_x86_64.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp36-cp36m-manylinux1_x86_64.whl


In doc/dev/download_wheels.sh line 14:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp37-cp37m-manylinux1_x86_64.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp37-cp37m-manylinux1_x86_64.whl


In doc/dev/download_wheels.sh line 15:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp38-cp38-manylinux1_x86_64.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp38-cp38-manylinux1_x86_64.whl


In doc/dev/download_wheels.sh line 17:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp35-cp35m-macosx_10_13_intel.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp35-cp35m-macosx_10_13_intel.whl


In doc/dev/download_wheels.sh line 18:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp36-cp36m-macosx_10_13_intel.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp36-cp36m-macosx_10_13_intel.whl


In doc/dev/download_wheels.sh line 19:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp37-cp37m-macosx_10_13_intel.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp37-cp37m-macosx_10_13_intel.whl


In doc/dev/download_wheels.sh line 21:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp38-cp38-macosx_10_13_x86_64.whl
                                                            ^----------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                         ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp38-cp38-macosx_10_13_x86_64.whl


In doc/examples/lm/preprocess.sh line 1:
cd ~/efs/lm
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
^---------^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

Did you mean:
cd ~/efs/lm || exit


In doc/examples/lm/ray_train.sh line 7:
MAX_POSITIONS=512          # Num. positional embeddings (usually same as above)
^-----------^ SC2034: MAX_POSITIONS appears unused. Verify use (or export if used externally).


In doc/examples/lm/ray_train.sh line 14:
mkdir -p $LOG_DIR
         ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$LOG_DIR"


In doc/examples/lm/ray_train.sh line 16:
python $HOME/efs/lm/ray_train.py --fp16 $DATA_DIR \
       ^---^ SC2086: Double quote to prevent globbing and word splitting.
                                        ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
python "$HOME"/efs/lm/ray_train.py --fp16 "$DATA_DIR" \


In doc/examples/lm/ray_train.sh line 26:
    --save-dir $LOG_DIR --ddp-backend=no_c10d
               ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    --save-dir "$LOG_DIR" --ddp-backend=no_c10d


In doc/tools/install-prometheus-server.sh line 8:
pushd $TOOLS_DIR
      ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
pushd "$TOOLS_DIR"


In doc/tools/install-prometheus-server.sh line 20:
    exit -1
         ^-- SC2242: Can only exit with status 0-255. Other data should be written to stdout/stderr.


In java/cleanup.sh line 1:
# Stop backend processes
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In java/cleanup.sh line 4:
ps aux | grep DefaultWorker | grep -v grep | awk '{print $2}' | xargs kill -9
^-- SC2009: Consider using pgrep instead of grepping ps output.


In java/generate_jni_header_files.sh line 13:
  javah -classpath ../bazel-bin/java/all_tests_deploy.jar $1
                                                          ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  javah -classpath ../bazel-bin/java/all_tests_deploy.jar "$1"


In java/generate_jni_header_files.sh line 14:
  clang-format -i $file
                  ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  clang-format -i "$file"


In java/generate_jni_header_files.sh line 16:
  cat <<EOF > ../src/ray/core_worker/lib/java/$file
                                              ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  cat <<EOF > ../src/ray/core_worker/lib/java/"$file"


In java/generate_jni_header_files.sh line 32:
  cat $file >> ../src/ray/core_worker/lib/java/$file
      ^---^ SC2086: Double quote to prevent globbing and word splitting.
                                               ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  cat "$file" >> ../src/ray/core_worker/lib/java/"$file"


In java/generate_jni_header_files.sh line 33:
  rm -f $file
        ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  rm -f "$file"


In java/test.sh line 23:
pushd $ROOT_DIR/..
      ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
pushd "$ROOT_DIR"/..


In java/test.sh line 39:
ENABLE_MULTI_LANGUAGE_TESTS=1 run_testng java -cp $ROOT_DIR/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output $ROOT_DIR/testng.xml
                                                  ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                                                  ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
ENABLE_MULTI_LANGUAGE_TESTS=1 run_testng java -cp "$ROOT_DIR"/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output "$ROOT_DIR"/testng.xml


In java/test.sh line 43:
run_testng java -Dray.run-mode="SINGLE_PROCESS" -cp $ROOT_DIR/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output $ROOT_DIR/testng.xml
                                                    ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                                                    ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
run_testng java -Dray.run-mode="SINGLE_PROCESS" -cp "$ROOT_DIR"/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output "$ROOT_DIR"/testng.xml


In java/test.sh line 47:
pushd $ROOT_DIR
      ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
pushd "$ROOT_DIR"


In python/build-wheel-macos.sh line 42:
source $HOME/.nvm/nvm.sh
       ^---------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.
       ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
source "$HOME"/.nvm/nvm.sh


In python/build-wheel-macos.sh line 64:
  curl $MACPYTHON_URL/$PY_VERSION/$PY_INST > $INST_PATH
                      ^---------^ SC2086: Double quote to prevent globbing and word splitting.
                                  ^------^ SC2086: Double quote to prevent globbing and word splitting.
                                             ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  curl $MACPYTHON_URL/"$PY_VERSION"/"$PY_INST" > "$INST_PATH"


In python/build-wheel-macos.sh line 65:
  sudo installer -pkg $INST_PATH -target /
                      ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  sudo installer -pkg "$INST_PATH" -target /


In python/build-wheel-macos.sh line 68:
  PIP_CMD="$(dirname $PYTHON_EXE)/pip$PY_MM"
                     ^---------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
  PIP_CMD="$(dirname "$PYTHON_EXE")/pip$PY_MM"


In python/build-wheel-macos.sh line 83:
    $PIP_CMD install -q numpy==$NUMPY_VERSION cython==0.29.15
                               ^------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    $PIP_CMD install -q numpy=="$NUMPY_VERSION" cython==0.29.15


In python/build-wheel-manylinux1.sh line 35:
source $HOME/.nvm/nvm.sh
       ^---------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.
       ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
source "$HOME"/.nvm/nvm.sh


In python/build-wheel-manylinux1.sh line 60:
    /opt/python/${PYTHON}/bin/pip install -q numpy==${NUMPY_VERSION} cython==0.29.15
                ^-------^ SC2086: Double quote to prevent globbing and word splitting.
                                                    ^--------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    /opt/python/"${PYTHON}"/bin/pip install -q numpy=="${NUMPY_VERSION}" cython==0.29.15


In python/build-wheel-manylinux1.sh line 69:
    PATH=/opt/python/${PYTHON}/bin:$PATH /opt/python/${PYTHON}/bin/python setup.py bdist_wheel
                                                     ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    PATH=/opt/python/${PYTHON}/bin:$PATH /opt/python/"${PYTHON}"/bin/python setup.py bdist_wheel


In python/build-wheel-manylinux1.sh line 78:
  find *.whl -exec bash -c 'mv $1 ${1//linux/manylinux1}' bash {} \;
       ^-- SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.


In python/ray/autoscaler/kubernetes/kubectl-rsync.sh line 9:
    exec rsync --blocking-io --rsh "$0" $@
                                        ^-- SC2068: Double quote array expansions to avoid re-splitting elements.


In python/ray/autoscaler/kubernetes/kubectl-rsync.sh line 25:
exec kubectl $namespace exec -i $pod -- "$@"
             ^--------^ SC2086: Double quote to prevent globbing and word splitting.
                                ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
exec kubectl "$namespace" exec -i "$pod" -- "$@"


In setup_hooks.sh line 2:
chmod +x $PWD/scripts/pre-push
         ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
chmod +x "$PWD"/scripts/pre-push


In setup_hooks.sh line 3:
ln -s $PWD/scripts/pre-push $PWD/.git/hooks/pre-push
      ^--^ SC2086: Double quote to prevent globbing and word splitting.
                            ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
ln -s "$PWD"/scripts/pre-push "$PWD"/.git/hooks/pre-push


In src/ray/test/run_object_manager_tests.sh line 12:
SCRIPT_DIR="`dirname \"$0\"`"
            ^--------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
SCRIPT_DIR="$(dirname \"$0\")"


In src/ray/test/run_object_manager_tests.sh line 15:
RAY_ROOT="`( cd \"$RAY_ROOT\" && pwd )`"
          ^---------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
RAY_ROOT="$(( cd \"$RAY_ROOT\" && pwd ))"


In src/ray/test/run_object_manager_tests.sh line 32:
bazel run //:redis-server -- --loglevel warning ${LOAD_MODULE_ARGS} --port 6379 &
                                                ^-----------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
bazel run //:redis-server -- --loglevel warning "${LOAD_MODULE_ARGS}" --port 6379 &


In src/ray/test/run_object_manager_valgrind.sh line 12:
SCRIPT_DIR="`dirname \"$0\"`"
            ^--------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
SCRIPT_DIR="$(dirname \"$0\")"


In src/ray/test/run_object_manager_valgrind.sh line 15:
RAY_ROOT="`( cd \"$RAY_ROOT\" && pwd )`"
          ^---------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
RAY_ROOT="$(( cd \"$RAY_ROOT\" && pwd ))"


In src/ray/test/run_object_manager_valgrind.sh line 35:
bazel run //:redis-server -- --loglevel warning ${LOAD_MODULE_ARGS} --port 6379 &
                                                ^-----------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
bazel run //:redis-server -- --loglevel warning "${LOAD_MODULE_ARGS}" --port 6379 &


In streaming/src/test/run_streaming_queue_test.sh line 10:
    nc -z localhost $port
                    ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    nc -z localhost "$port"


In streaming/src/test/run_streaming_queue_test.sh line 11:
    if [[ $? != 0 ]]; then
          ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In streaming/src/test/run_streaming_queue_test.sh line 27:
SCRIPT_DIR="`dirname \"$0\"`"
            ^--------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
SCRIPT_DIR="$(dirname \"$0\")"


In streaming/src/test/run_streaming_queue_test.sh line 30:
SCRIPT_DIR="`dirname \"$0\"`"
            ^--------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
SCRIPT_DIR="$(dirname \"$0\")"


In streaming/src/test/run_streaming_queue_test.sh line 33:
RAY_ROOT="`( cd \"$RAY_ROOT\" && pwd )`"
          ^---------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
RAY_ROOT="$(( cd \"$RAY_ROOT\" && pwd ))"


In streaming/src/test/run_streaming_queue_test.sh line 58:
./bazel-bin/streaming/streaming_queue_tests $STORE_EXEC $RAYLET_EXEC $RAYLET_PORT $STREAMING_TEST_WORKER_EXEC $GCS_SERVER_EXEC $REDIS_SERVER_EXEC $REDIS_MODULE $REDIS_CLIENT_EXEC
                                                                     ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
./bazel-bin/streaming/streaming_queue_tests $STORE_EXEC $RAYLET_EXEC "$RAYLET_PORT" $STREAMING_TEST_WORKER_EXEC $GCS_SERVER_EXEC $REDIS_SERVER_EXEC $REDIS_MODULE $REDIS_CLIENT_EXEC


In ci/keep_alive line 8:
    for i in `seq 2 2 150`; do
             ^-----------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
    for i in $(seq 2 2 150); do


In ci/keep_alive line 16:
watchdog & 2>/dev/null
           ^---------^ SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).


In ci/suppress_output line 4:
TMPFILE=`mktemp`
        ^------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
TMPFILE=$(mktemp)


In ci/suppress_output line 9:
    for i in `seq 5 5 150`; do
             ^-----------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean:
    for i in $(seq 5 5 150); do


In ci/suppress_output line 14:
    cat $TMPFILE
        ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    cat "$TMPFILE"


In ci/suppress_output line 19:
watchdog & 2>/dev/null
           ^---------^ SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).


In ci/suppress_output line 22:
time "$@" >$TMPFILE 2>&1
           ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
time "$@" >"$TMPFILE" 2>&1


In ci/suppress_output line 26:
    tail -n 2000 $TMPFILE
                 ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
    tail -n 2000 "$TMPFILE"

For more information:
  https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
  https://www.shellcheck.net/wiki/SC2071 -- > is for string comparisons. Use ...
  https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ...
shellcheck failed; this patch might fix some issues (but please double-check it):
Suggested patch (not correct in every situation)
--- a/build.sh
+++ b/build.sh
@@ -85,7 +85,7 @@
   PYTHON_EXECUTABLE=$(which python)
 fi

-PYTHON_VERSION=`"$PYTHON_EXECUTABLE" -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))'`
+PYTHON_VERSION=$("$PYTHON_EXECUTABLE" -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))')
 found=
 for allowed in ${SUPPORTED_PYTHONS[@]}
 do
@@ -128,7 +128,7 @@


 if [ "$RAY_BUILD_JAVA" == "YES" ]; then
-  "$BAZEL_EXECUTABLE" build ${ENABLE_ASAN-} //java:ray_java_pkg --verbose_failures
+  "$BAZEL_EXECUTABLE" build "${ENABLE_ASAN-}" //java:ray_java_pkg --verbose_failures
 fi

 if [ "$RAY_BUILD_PYTHON" == "YES" ]; then
@@ -160,7 +160,7 @@

   export PYTHON3_BIN_PATH="$PYTHON_EXECUTABLE"

-  "$BAZEL_EXECUTABLE" build ${ENABLE_ASAN-} //:ray_pkg --verbose_failures
+  "$BAZEL_EXECUTABLE" build "${ENABLE_ASAN-}" //:ray_pkg --verbose_failures
 fi

 popd

--- a/ci/jenkins_tests/entry_point.sh
+++ b/ci/jenkins_tests/entry_point.sh
@@ -32,13 +32,13 @@
 }

 if [[ ! -z "$RUN_TUNE_TESTS" ]]; then
-    retry bash $ROOT_DIR/run_tune_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
+    retry bash "$ROOT_DIR"/run_tune_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
 fi

 if [[ ! -z "$RUN_DOC_TESTS" ]]; then
-    retry bash $ROOT_DIR/run_doc_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
+    retry bash "$ROOT_DIR"/run_doc_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
 fi

 if [[ ! -z "$RUN_SGD_TESTS" ]]; then
-    retry bash $ROOT_DIR/run_sgd_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
+    retry bash "$ROOT_DIR"/run_sgd_tests.sh ${MEMORY_SIZE} ${SHM_SIZE}
 fi
\ No newline at end of file

--- a/ci/jenkins_tests/run_doc_tests.sh
+++ b/ci/jenkins_tests/run_doc_tests.sh
@@ -33,23 +33,23 @@
     fi
 fi

-echo "Using Docker image" $DOCKER_SHA
+echo "Using Docker image" "$DOCKER_SHA"


 ######################## EXAMPLE TESTS #################################

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/doc/examples/plot_pong_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/doc/examples/plot_parameter_server.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/doc/examples/plot_hyperparameter.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/doc/examples/doc_code/torch_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/doc/examples/doc_code/tf_example.py


--- a/ci/jenkins_tests/run_multi_node_tests.sh
+++ b/ci/jenkins_tests/run_multi_node_tests.sh
@@ -1,10 +1,10 @@
 # This file exists for Jenkins compatiblity

-ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
+ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")" || exit; pwd)

 export RUN_TUNE_TESTS=1
 export RUN_DOC_TESTS=1
 export RUN_SGD_TESTS=1
 export CI_BUILD_FROM_SOURCE=1

-bash $ROOT_DIR/entry_point.sh
+bash "$ROOT_DIR"/entry_point.sh

--- a/ci/jenkins_tests/run_sgd_tests.sh
+++ b/ci/jenkins_tests/run_sgd_tests.sh
@@ -33,62 +33,62 @@
     fi
 fi

-echo "Using Docker image" $DOCKER_SHA
+echo "Using Docker image" "$DOCKER_SHA"


 ######################## SGD TESTS #################################

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python -m pytest /ray/python/ray/util/sgd/tests

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/raysgd_torch_signatures.py


-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
 python /ray/python/ray/util/sgd/torch/examples/image_models/train.py --no-gpu --mock-data --smoke-test --ray-num-workers=2 --model mobilenetv3_small_075 data

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/train_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/train_example.py --num-workers=2

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/tune_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/tune_example.py --num-workers=2

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/cifar_pytorch_example.py --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/cifar_pytorch_example.py --smoke-test --num-workers=2

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/cifar_pytorch_pbt.py --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/dcgan.py --smoke-test --num-workers=2

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/torch/examples/benchmarks/benchmark.py --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/tf/examples/tensorflow_train_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/tf/examples/tensorflow_train_example.py --num-replicas=2

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/tf/examples/tensorflow_train_example.py --tune

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/tf/examples/cifar_tf_example.py --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/tf/examples/cifar_tf_example.py --num-replicas 2 --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/util/sgd/tf/examples/cifar_tf_example.py --num-replicas 2 --smoke-test --augment-data

--- a/ci/jenkins_tests/run_tune_tests.sh
+++ b/ci/jenkins_tests/run_tune_tests.sh
@@ -34,63 +34,63 @@
     fi
 fi

-echo "Using Docker image" $DOCKER_SHA
+echo "Using Docker image" "$DOCKER_SHA"

 ######################## TUNE TESTS #################################

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     pytest /ray/python/ray/tune/tests/test_actor_reuse.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     pytest /ray/python/ray/tune/tests/test_tune_restore.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/tests/example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     bash -c 'pip install -U tensorflow && python /ray/python/ray/tune/tests/test_logger.py'

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     bash -c 'pip install -U tensorflow==1.15 && python /ray/python/ray/tune/tests/test_logger.py'

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     bash -c 'pip install -U tensorflow==1.14 && python /ray/python/ray/tune/tests/test_logger.py'

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 -e MPLBACKEND=Agg $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 -e MPLBACKEND=Agg "$DOCKER_SHA" \
     python /ray/python/ray/tune/tests/tutorial.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/pbt_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/hyperband_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/async_hyperband_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/tf_mnist_example.py --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/lightgbm_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/xgboost_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/logging_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/mlflow_example.py

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/bayesopt_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/hyperopt_example.py \
     --smoke-test

@@ -101,34 +101,34 @@
 # fi

 # Runs only on Python3
-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/nevergrad_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/tune_mnist_keras.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/mnist_pytorch.py --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/mnist_pytorch_trainable.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/genetic_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/skopt_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/dragonfly_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/zoopt_example.py \
     --smoke-test

@@ -137,18 +137,18 @@
 #     python /ray/python/ray/tune/examples/pbt_memnn_example.py \
 #     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/pbt_convnet_example.py \
     --smoke-test

-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist.py \
     --smoke-test

 # uncomment once statsmodels is updated.
-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     python /ray/python/ray/tune/examples/bohb_example.py

 # Moved to bottom because flaky
-$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 $DOCKER_SHA \
+$SUPPRESS_OUTPUT docker run --rm --shm-size=${SHM_SIZE} --memory=${MEMORY_SIZE} --memory-swap=-1 "$DOCKER_SHA" \
     pytest /ray/python/ray/tune/tests/test_cluster.py

--- a/ci/travis/bazel-format.sh
+++ b/ci/travis/bazel-format.sh
@@ -43,8 +43,8 @@
   shift
 done

-pushd $ROOT_DIR/../..
+pushd "$ROOT_DIR"/../..
 BAZEL_FILES="bazel/BUILD bazel/BUILD.arrow bazel/ray.bzl BUILD.bazel java/BUILD.bazel
  cpp/BUILD.bazel streaming/BUILD.bazel streaming/java/BUILD.bazel WORKSPACE"
-buildifier -mode=$RUN_TYPE -diff_command="diff -u" $BAZEL_FILES
+buildifier -mode=$RUN_TYPE -diff_command="diff -u" "$BAZEL_FILES"
 popd

--- a/ci/travis/build-autoscaler-images.sh
+++ b/ci/travis/build-autoscaler-images.sh
@@ -4,7 +4,7 @@
 set -x

 SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
-ROOT_DIR=$(cd $SCRIPT_DIR/../../; pwd)
+ROOT_DIR=$(cd "$SCRIPT_DIR"/../../; pwd)
 DOCKER_USERNAME="raytravisbot"

 # We will only build and push when we are building branch build.
@@ -13,25 +13,25 @@

     docker build -q -t rayproject/base-deps docker/base-deps

-    wheel=$(cd $ROOT_DIR/.whl; ls | grep cp36m-manylinux)
-    commit_sha=$(echo $TRAVIS_COMMIT | head -c 6)
-    cp -r $ROOT_DIR/.whl $ROOT_DIR/docker/autoscaler/.whl
+    wheel=$(cd "$ROOT_DIR"/.whl; ls | grep cp36m-manylinux)
+    commit_sha=$(echo "$TRAVIS_COMMIT" | head -c 6)
+    cp -r "$ROOT_DIR"/.whl "$ROOT_DIR"/docker/autoscaler/.whl

     docker build \
         --build-arg WHEEL_PATH=".whl/$wheel" \
-        --build-arg WHEEL_NAME=$wheel \
-        -t rayproject/autoscaler:$commit_sha \
-        $ROOT_DIR/docker/autoscaler
-    docker push rayproject/autoscaler:$commit_sha
+        --build-arg WHEEL_NAME="$wheel" \
+        -t rayproject/autoscaler:"$commit_sha" \
+        "$ROOT_DIR"/docker/autoscaler
+    docker push rayproject/autoscaler:"$commit_sha"

     # We have a branch build, e.g. release/v0.7.0
     if [[ "$TRAVIS_BRANCH" != "master" ]]; then
        # Replace / in branch name to - so it is legal tag name
-       normalized_branch_name=$(echo $TRAVIS_BRANCH | sed -e "s/\//-/")
-       docker tag rayproject/autoscaler:$commit_sha rayproject/autoscaler:$normalized_branch_name
-       docker push rayproject/autoscaler:$normalized_branch_name
+       normalized_branch_name=$(echo "$TRAVIS_BRANCH" | sed -e "s/\//-/")
+       docker tag rayproject/autoscaler:"$commit_sha" rayproject/autoscaler:"$normalized_branch_name"
+       docker push rayproject/autoscaler:"$normalized_branch_name"
     else
-       docker tag rayproject/autoscaler:$commit_sha rayproject/autoscaler:latest
+       docker tag rayproject/autoscaler:"$commit_sha" rayproject/autoscaler:latest
        docker push rayproject/autoscaler:latest
     fi
 fi

--- a/ci/travis/ci.sh
+++ b/ci/travis/ci.sh
@@ -370,7 +370,7 @@
     eval "${restore_shell_state}" "${expression}"  # Restore set -x, then evaluate expression
   fi

-  if ! (set +x && should_run_job ${job_names//,/ }); then
+  if ! (set +x && should_run_job "${job_names//,/ }"); then
     if [ -n "${GITHUB_WORKFLOW-}" ]; then
       # If this job is to be skipped, emit 'exit' into .bashrc to quickly exit all following steps.
       # This isn't needed on Travis (since everything runs in one shell), but is on GitHub Actions.
@@ -416,7 +416,7 @@

 build() {
   if ! need_wheels; then
-    bazel build ${ENABLE_ASAN-} -k "//:*"   # Do a full build first to ensure everything passes
+    bazel build "${ENABLE_ASAN-}" -k "//:*"   # Do a full build first to ensure everything passes
     install_ray
     if [ "${LINT-}" = 1 ]; then
       # Try generating Sphinx documentation. To do this, we need to install Ray first.

--- a/ci/travis/format.sh
+++ b/ci/travis/format.sh
@@ -21,7 +21,7 @@
             echo "$1 is not a required dependency"
             exit 1
     esac
-    if ! [ -x "$(command -v $1)" ]; then
+    if ! [ -x "$(command -v "$1")" ]; then
         echo "$1 not installed. pip install $1==$VERSION"
         exit 1
     fi
@@ -31,7 +31,7 @@
 check_command_exist flake8

 ver=$(yapf --version)
-if ! echo $ver | grep -q 0.23.0; then
+if ! echo "$ver" | grep -q 0.23.0; then
     echo "Wrong YAPF version installed: 0.23.0 is required, not $ver. $YAPF_DOWNLOAD_COMMAND_MSG"
     exit 1
 fi
@@ -57,12 +57,12 @@
     fi
 }

-tool_version_check "flake8" $FLAKE8_VERSION $FLAKE8_VERSION_REQUIRED
-tool_version_check "yapf" $YAPF_VERSION $YAPF_VERSION_REQUIRED
+tool_version_check "flake8" "$FLAKE8_VERSION" $FLAKE8_VERSION_REQUIRED
+tool_version_check "yapf" "$YAPF_VERSION" $YAPF_VERSION_REQUIRED

 if which clang-format >/dev/null; then
   CLANG_FORMAT_VERSION=$(clang-format --version | awk '{print $3}')
-  tool_version_check "clang-format" $CLANG_FORMAT_VERSION "7.0.0"
+  tool_version_check "clang-format" "$CLANG_FORMAT_VERSION" "7.0.0"
 else
     echo "WARNING: clang-format is not installed!"
 fi

--- a/debug.sh
+++ b/debug.sh
@@ -18,7 +18,7 @@
                        else
                                flags="${flags} -w -v"
                        fi
-                       if killall -u "${USER}" -g ${flags} -s "${sig}" python3 ray::IDLE redis-server; then
+                       if killall -u "${USER}" -g "${flags}" -s "${sig}" python3 ray::IDLE redis-server; then
                                sleep 0.01
                        fi
                } || true
@@ -78,7 +78,7 @@
        while IFS="" read -r -d "" line; do if [ "${envvars[${line%%=*}]-}" = "${line#*=}" ]; then unset envvars["${line%%=*}"]; else envvararr+=("${line%%=*}"); fi; done < /proc/self/environ;
        unset "${envvararr[@]}"
        envvararr=()
-       local key; for key in "${!envvars[@]}"; do envvararr+=("${key}"="${envvars[${key}]}"); done
+       local key; for key in "${!envvars[@]}"; do envvararr+=("${key}""=""${envvars[${key}]}"); done
        declare -x -- "${envvararr[@]}" 2> /dev/null || true
        "$@"
 }

--- a/doc/azure/azure-init.sh
+++ b/doc/azure/azure-init.sh
@@ -7,11 +7,11 @@
 TYPE=$5

 echo "Installing wheel..."
-sudo -u $USERNAME -i /bin/bash -l -c "conda init bash"
-sudo -u $USERNAME -i /bin/bash -l -c "conda activate $CONDA_ENV; pip install $WHEEL"
+sudo -u "$USERNAME" -i /bin/bash -l -c "conda init bash"
+sudo -u "$USERNAME" -i /bin/bash -l -c "conda activate $CONDA_ENV; pip install $WHEEL"

 echo "Setting up service scripts..."
-cat > /home/$USERNAME/ray-head.sh << EOM
+cat > /home/"$USERNAME"/ray-head.sh << EOM
 #!/bin/bash
 conda activate $CONDA_ENV

@@ -22,7 +22,7 @@
 ray start --head --redis-port=6379 --object-manager-port=8076 --num-gpus=\$NUM_GPUS --block --webui-host 0.0.0.0
 EOM

-cat > /home/$USERNAME/ray-worker.sh << EOM
+cat > /home/"$USERNAME"/ray-worker.sh << EOM
 #!/bin/bash
 conda activate $CONDA_ENV

@@ -39,7 +39,7 @@
 done
 EOM

-cat > /home/$USERNAME/tensorboard.sh << EOM
+cat > /home/"$USERNAME"/tensorboard.sh << EOM
 #!/bin/bash

 conda activate $CONDA_ENV
@@ -48,9 +48,9 @@
 tensorboard --bind_all --logdir=/home/$USERNAME/ray_results
 EOM

-chmod +x /home/$USERNAME/ray-head.sh
-chmod +x /home/$USERNAME/ray-worker.sh
-chmod +x /home/$USERNAME/tensorboard.sh
+chmod +x /home/"$USERNAME"/ray-head.sh
+chmod +x /home/"$USERNAME"/ray-worker.sh
+chmod +x /home/"$USERNAME"/tensorboard.sh

 cat > /lib/systemd/system/ray.service << EOM
 [Unit]

--- a/doc/dev/bin/pip_download_test.sh
+++ b/doc/dev/bin/pip_download_test.sh
@@ -52,7 +52,7 @@
     echo "=========================================================\n\n\n"

     conda deactivate
-    conda remove -y --name ${env_name} --all
+    conda remove -y --name "${env_name}" --all
     if [ "$failed" = true ]; then
         echo "PYTHON ${PYTHON_VERSION} failed sanity check."
         exit 1

--- a/doc/dev/download_wheels.sh
+++ b/doc/dev/download_wheels.sh
@@ -9,13 +9,13 @@
 fi

 # Make sure Linux wheels are downloadable without errors.
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp35-cp35m-manylinux1_x86_64.whl
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp36-cp36m-manylinux1_x86_64.whl
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp37-cp37m-manylinux1_x86_64.whl
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp38-cp38-manylinux1_x86_64.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp35-cp35m-manylinux1_x86_64.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp36-cp36m-manylinux1_x86_64.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp37-cp37m-manylinux1_x86_64.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp38-cp38-manylinux1_x86_64.whl
 # Make sure macos wheels are downloadable without errors.
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp35-cp35m-macosx_10_13_intel.whl
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp36-cp36m-macosx_10_13_intel.whl
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp37-cp37m-macosx_10_13_intel.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp35-cp35m-macosx_10_13_intel.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp36-cp36m-macosx_10_13_intel.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp37-cp37m-macosx_10_13_intel.whl
 # Wheel name convention has been changed from Python 3.8.
-wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/$RAY_VERSION/$RAY_HASH/ray-$RAY_VERSION-cp38-cp38-macosx_10_13_x86_64.whl
+wget https://s3-us-west-2.amazonaws.com/ray-wheels/releases/"$RAY_VERSION"/"$RAY_HASH"/ray-"$RAY_VERSION"-cp38-cp38-macosx_10_13_x86_64.whl

--- a/doc/examples/lm/preprocess.sh
+++ b/doc/examples/lm/preprocess.sh
@@ -1,4 +1,4 @@
-cd ~/efs/lm
+cd ~/efs/lm || exit

 # download the dataset
 wget https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-raw-v1.zip

--- a/doc/examples/lm/ray_train.sh
+++ b/doc/examples/lm/ray_train.sh
@@ -11,9 +11,9 @@

 LOG_DIR=$HOME/efs/lm/log/
 DATA_DIR=$HOME/efs/lm/data-bin/wikitext-103/
-mkdir -p $LOG_DIR
+mkdir -p "$LOG_DIR"

-python $HOME/efs/lm/ray_train.py --fp16 $DATA_DIR \
+python "$HOME"/efs/lm/ray_train.py --fp16 "$DATA_DIR" \
     --task masked_lm --criterion masked_lm \
     --arch roberta_base --sample-break-mode complete --tokens-per-sample $TOKENS_PER_SAMPLE \
     --optimizer adam --adam-betas '(0.9, 0.98)' --adam-eps 1e-6 --clip-norm 0.0 \
@@ -23,4 +23,4 @@
     --fix-batch-size $FIX_BATCH_SIZE \
     --max-update $TOTAL_UPDATES --log-format simple --log-interval 1 \
     --save-interval-updates $SAVE_INTERVAL_UPDATES \
-    --save-dir $LOG_DIR --ddp-backend=no_c10d
+    --save-dir "$LOG_DIR" --ddp-backend=no_c10d

--- a/doc/tools/install-prometheus-server.sh
+++ b/doc/tools/install-prometheus-server.sh
@@ -5,7 +5,7 @@

 TOOLS_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)

-pushd $TOOLS_DIR
+pushd "$TOOLS_DIR"

 # Download Prometheus server.
 unamestr="$(uname)"

--- a/java/generate_jni_header_files.sh
+++ b/java/generate_jni_header_files.sh
@@ -10,10 +10,10 @@
 function generate_one()
 {
   file=${1//./_}.h
-  javah -classpath ../bazel-bin/java/all_tests_deploy.jar $1
-  clang-format -i $file
+  javah -classpath ../bazel-bin/java/all_tests_deploy.jar "$1"
+  clang-format -i "$file"

-  cat <<EOF > ../src/ray/core_worker/lib/java/$file
+  cat <<EOF > ../src/ray/core_worker/lib/java/"$file"
 // Copyright 2017 The Ray Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,8 @@
 // limitations under the License.

 EOF
-  cat $file >> ../src/ray/core_worker/lib/java/$file
-  rm -f $file
+  cat "$file" >> ../src/ray/core_worker/lib/java/"$file"
+  rm -f "$file"
 }

 generate_one io.ray.runtime.RayNativeRuntime

--- a/java/test.sh
+++ b/java/test.sh
@@ -20,7 +20,7 @@
     fi
 }

-pushd $ROOT_DIR/..
+pushd "$ROOT_DIR"/..
 echo "Linting Java code with checkstyle."
 # NOTE(hchen): The `test_tag_filters` option causes bazel to ignore caches.
 # Thus, we add the `build_tests_only` option to avoid re-building everything.
@@ -36,15 +36,15 @@
 # TODO(hchen): Ideally, we should use the following bazel command to run Java tests. However, if there're skipped tests,
 # TestNG will exit with code 2. And bazel treats it as test failure.
 # bazel test //java:all_tests --action_env=ENABLE_MULTI_LANGUAGE_TESTS=1 --test_output="errors" || cluster_exit_code=$?
-ENABLE_MULTI_LANGUAGE_TESTS=1 run_testng java -cp $ROOT_DIR/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output $ROOT_DIR/testng.xml
+ENABLE_MULTI_LANGUAGE_TESTS=1 run_testng java -cp "$ROOT_DIR"/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output "$ROOT_DIR"/testng.xml

 echo "Running tests under single-process mode."
 # bazel test //java:all_tests --jvmopt="-Dray.run-mode=SINGLE_PROCESS" --test_output="errors" || single_exit_code=$?
-run_testng java -Dray.run-mode="SINGLE_PROCESS" -cp $ROOT_DIR/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output $ROOT_DIR/testng.xml
+run_testng java -Dray.run-mode="SINGLE_PROCESS" -cp "$ROOT_DIR"/../bazel-bin/java/all_tests_deploy.jar org.testng.TestNG -d /tmp/ray_java_test_output "$ROOT_DIR"/testng.xml

 popd

-pushd $ROOT_DIR
+pushd "$ROOT_DIR"
 echo "Testing maven install."
 mvn -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN clean install -DskipTests
 popd

--- a/python/build-wheel-macos.sh
+++ b/python/build-wheel-macos.sh
@@ -39,7 +39,7 @@
 mkdir -p .whl

 # Use the latest version of Node.js in order to build the dashboard.
-source $HOME/.nvm/nvm.sh
+source "$HOME"/.nvm/nvm.sh
 nvm use node

 # Build the dashboard so its static assets can be included in the wheel.
@@ -61,11 +61,11 @@

   # Install Python.
   INST_PATH=python_downloads/$PY_INST
-  curl $MACPYTHON_URL/$PY_VERSION/$PY_INST > $INST_PATH
-  sudo installer -pkg $INST_PATH -target /
+  curl $MACPYTHON_URL/"$PY_VERSION"/"$PY_INST" > "$INST_PATH"
+  sudo installer -pkg "$INST_PATH" -target /

   PYTHON_EXE=$MACPYTHON_PY_PREFIX/$PY_MM/bin/python$PY_MM
-  PIP_CMD="$(dirname $PYTHON_EXE)/pip$PY_MM"
+  PIP_CMD="$(dirname "$PYTHON_EXE")/pip$PY_MM"

   pushd /tmp
     # Install latest version of pip to avoid brownouts.
@@ -80,7 +80,7 @@
     $PIP_CMD install -q setuptools_scm==3.1.0
     # Fix the numpy version because this will be the oldest numpy version we can
     # support.
-    $PIP_CMD install -q numpy==$NUMPY_VERSION cython==0.29.15
+    $PIP_CMD install -q numpy=="$NUMPY_VERSION" cython==0.29.15
     # Install wheel to avoid the error "invalid command 'bdist_wheel'".
     $PIP_CMD install -q wheel
     # Set the commit SHA in __init__.py.

--- a/python/build-wheel-manylinux1.sh
+++ b/python/build-wheel-manylinux1.sh
@@ -32,7 +32,7 @@
 # Install and use the latest version of Node.js in order to build the dashboard.
 set +x
 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
-source $HOME/.nvm/nvm.sh
+source "$HOME"/.nvm/nvm.sh
 nvm install node
 nvm use node

@@ -57,7 +57,7 @@
   pushd python
     # Fix the numpy version because this will be the oldest numpy version we can
     # support.
-    /opt/python/${PYTHON}/bin/pip install -q numpy==${NUMPY_VERSION} cython==0.29.15
+    /opt/python/"${PYTHON}"/bin/pip install -q numpy=="${NUMPY_VERSION}" cython==0.29.15
     # Set the commit SHA in __init__.py.
     if [ -n "$TRAVIS_COMMIT" ]; then
       sed -i.bak "s/{{RAY_COMMIT_SHA}}/$TRAVIS_COMMIT/g" ray/__init__.py && rm ray/__init__.py.bak
@@ -66,7 +66,7 @@
       exit 1
     fi

-    PATH=/opt/python/${PYTHON}/bin:$PATH /opt/python/${PYTHON}/bin/python setup.py bdist_wheel
+    PATH=/opt/python/${PYTHON}/bin:$PATH /opt/python/"${PYTHON}"/bin/python setup.py bdist_wheel
     # In the future, run auditwheel here.
     mv dist/*.whl ../.whl/
   popd

--- a/python/ray/autoscaler/kubernetes/kubectl-rsync.sh
+++ b/python/ray/autoscaler/kubernetes/kubectl-rsync.sh
@@ -22,4 +22,4 @@
     shift
 fi

-exec kubectl $namespace exec -i $pod -- "$@"
+exec kubectl "$namespace" exec -i "$pod" -- "$@"

--- a/setup_hooks.sh
+++ b/setup_hooks.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
-chmod +x $PWD/scripts/pre-push
-ln -s $PWD/scripts/pre-push $PWD/.git/hooks/pre-push
+chmod +x "$PWD"/scripts/pre-push
+ln -s "$PWD"/scripts/pre-push "$PWD"/.git/hooks/pre-push

--- a/src/ray/test/run_object_manager_tests.sh
+++ b/src/ray/test/run_object_manager_tests.sh
@@ -9,10 +9,10 @@
 bazel build "//:object_manager_stress_test" "//:object_manager_test" "//:plasma_store_server"

 # Get the directory in which this script is executing.
-SCRIPT_DIR="`dirname \"$0\"`"
+SCRIPT_DIR="$(dirname \"$0\")"
 RAY_ROOT="$SCRIPT_DIR/../../.."
 # Makes $RAY_ROOT an absolute path.
-RAY_ROOT="`( cd \"$RAY_ROOT\" && pwd )`"
+RAY_ROOT="$(( cd \"$RAY_ROOT\" && pwd ))"
 if [ -z "$RAY_ROOT" ] ; then
   exit 1
 fi
@@ -29,7 +29,7 @@
 # Allow cleanup commands to fail.
 bazel run //:redis-cli -- -p 6379 shutdown || true
 sleep 1s
-bazel run //:redis-server -- --loglevel warning ${LOAD_MODULE_ARGS} --port 6379 &
+bazel run //:redis-server -- --loglevel warning "${LOAD_MODULE_ARGS}" --port 6379 &
 sleep 1s
 # Run tests.
 ./bazel-bin/object_manager_stress_test $STORE_EXEC

--- a/src/ray/test/run_object_manager_valgrind.sh
+++ b/src/ray/test/run_object_manager_valgrind.sh
@@ -9,10 +9,10 @@
 bazel build "//:object_manager_stress_test" "//:object_manager_test" "//:plasma_store_server"

 # Get the directory in which this script is executing.
-SCRIPT_DIR="`dirname \"$0\"`"
+SCRIPT_DIR="$(dirname \"$0\")"
 RAY_ROOT="$SCRIPT_DIR/../../.."
 # Makes $RAY_ROOT an absolute path.
-RAY_ROOT="`( cd \"$RAY_ROOT\" && pwd )`"
+RAY_ROOT="$(( cd \"$RAY_ROOT\" && pwd ))"
 if [ -z "$RAY_ROOT" ] ; then
   exit 1
 fi
@@ -32,7 +32,7 @@
 killall plasma_store || true
 bazel run //:redis-cli -- -p 6379 shutdown || true
 sleep 1s
-bazel run //:redis-server -- --loglevel warning ${LOAD_MODULE_ARGS} --port 6379 &
+bazel run //:redis-server -- --loglevel warning "${LOAD_MODULE_ARGS}" --port 6379 &
 sleep 1s

 # Run tests. Use timeout=10000ms for the Wait tests since tests run slower

--- a/streaming/src/test/run_streaming_queue_test.sh
+++ b/streaming/src/test/run_streaming_queue_test.sh
@@ -7,7 +7,7 @@
 PORTS="2000 2001 2002 2003 2004 2005 2006 2007 2008 2009"
 RAYLET_PORT=0
 for port in $PORTS; do
-    nc -z localhost $port
+    nc -z localhost "$port"
     if [[ $? != 0 ]]; then
         RAYLET_PORT=$port
         break
@@ -24,13 +24,13 @@
 set -x

 # Get the directory in which this script is executing.
-SCRIPT_DIR="`dirname \"$0\"`"
+SCRIPT_DIR="$(dirname \"$0\")"

 # Get the directory in which this script is executing.
-SCRIPT_DIR="`dirname \"$0\"`"
+SCRIPT_DIR="$(dirname \"$0\")"
 RAY_ROOT="$SCRIPT_DIR/../../.."
 # Makes $RAY_ROOT an absolute path.
-RAY_ROOT="`( cd \"$RAY_ROOT\" && pwd )`"
+RAY_ROOT="$(( cd \"$RAY_ROOT\" && pwd ))"
 if [ -z "$RAY_ROOT" ] ; then
   exit 1
 fi
@@ -55,5 +55,5 @@

 # Allow cleanup commands to fail.
 # Run tests.
-./bazel-bin/streaming/streaming_queue_tests $STORE_EXEC $RAYLET_EXEC $RAYLET_PORT $STREAMING_TEST_WORKER_EXEC $GCS_SERVER_EXEC $REDIS_SERVER_EXEC $REDIS_MODULE $REDIS_CLIENT_EXEC
+./bazel-bin/streaming/streaming_queue_tests $STORE_EXEC $RAYLET_EXEC "$RAYLET_PORT" $STREAMING_TEST_WORKER_EXEC $GCS_SERVER_EXEC $REDIS_SERVER_EXEC $REDIS_MODULE $REDIS_CLIENT_EXEC
 sleep 1s

--- a/ci/keep_alive
+++ b/ci/keep_alive
@@ -5,7 +5,7 @@

 # Print output to avoid travis killing us
 watchdog() {
-    for i in `seq 2 2 150`; do
+    for i in $(seq 2 2 150); do
         sleep 120
         echo "(running, ${i}m total)"
     done

--- a/ci/suppress_output
+++ b/ci/suppress_output
@@ -1,17 +1,17 @@
 #!/bin/bash
 # Run a command, suppressing output unless it hangs or crashes.

-TMPFILE=`mktemp`
+TMPFILE=$(mktemp)
 PID=$$

 # Print output to avoid travis killing us
 watchdog() {
-    for i in `seq 5 5 150`; do
+    for i in $(seq 5 5 150); do
         sleep 300
         echo "This command has been running for more than $i minutes..."
     done
     echo "Command timed out after 2.5h, dumping logs:"
-    cat $TMPFILE
+    cat "$TMPFILE"
     echo "TIMED OUT"
     kill -SIGKILL $PID
 }
@@ -19,11 +19,11 @@
 watchdog & 2>/dev/null
 WATCHDOG_PID=$!

-time "$@" >$TMPFILE 2>&1
+time "$@" >"$TMPFILE" 2>&1

 CODE=$?
 if [ $CODE != 0 ]; then
-    tail -n 2000 $TMPFILE
+    tail -n 2000 "$TMPFILE"
     echo "FAILED $CODE"
     kill $WATCHDOG_PID
     exit $CODE

@simon-mo simon-mo requested review from edoakes and pcmoritz June 10, 2020 02:05
Copy link
Copy Markdown
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mehrdadn could you provide some more context on what this is doing / what issues it'll help us catch?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is pretty unintelligible to me. What is it doing?

Copy link
Copy Markdown
Contributor Author

@mehrdadn mehrdadn Jun 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'm currently using this script to run shellcheck on genrules. To do that it needs to call Bazel to output the genrule scripts after Bazel has preprocessed them. Bazel then outputs the scripts in its textproto format, which I parse here and then invoke shellcheck on. It'll help us catch issues like if someone writes rm -rf $$WORKSPACE_DIR/foo (forgetting to quote it)... which could wipe someone's files by accident.

The check-shell-scripts.sh script is responsible for checking all shell scripts, and it invokes bazel.py to handle the ones embedded in Bazel genrules.

But it's probably worth mentioning: I imagine this file will probably get more Bazel-related functionality later on (in fact there are already things that I'm hoping to migrate from Bash to Bazel using this once it's merged), since invoking Bazel and parsing its output are common subfunctionality for lots of scripts. It's worth keeping that in mind when reviewing. It'll become more useful as time goes on. (That's also why I kept the module name generic and also easy to import.)

I've refactored this file and migrated an existing Bash script (bazel-preclean.sh) to use its common functionality for better readability.

For reviewing, I think it's probably easier to understand if you follow the logic starting in main() (which would be reading bottom-up). Let me know if I should add any explanations along the way. I also highly recommend playing around with it (run ci/travis/check-shell-scripts.sh).

@mehrdadn mehrdadn force-pushed the shellcheck branch 11 times, most recently from b6cc9f3 to 3f85ba9 Compare June 30, 2020 01:21
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jun 30, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
@ray-project ray-project deleted a comment from AmplabJenkins Jul 27, 2020
local name="shellcheck-v${shellcheck_version}"
if [ "${osname}" = linux ] || [ "${osname}" = darwin ]; then
sudo mkdir -p /usr/local/bin || true
curl -f -s -L "https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/${name}.${osname}.x86_64.tar.xz" | {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is truly a Travis CI script, then travis already has shellcheck installable: koalaman/shellcheck#589

The less we can curl | sudo the better.

Copy link
Copy Markdown
Contributor Author

@mehrdadn mehrdadn Jul 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need 0.7.1 specifically. Travis has 0.7.0 which is too noisy to be useful. And people need to know which version to run locally too, otherwise they will get lint errors on CI that they don't get locally (which leads to a bad experience).

fi

if shellcheck --shell=sh --format=diff - < /dev/null; then
if [ 0 -lt "${#bazel_files[@]}" ]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful with string and integer comparisons in bash (and elsewhere)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am :-) this is correct!

return result


def shellcheck(bazel_aquery, *shellcheck_args):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file could really use some comments. What are you trying to do for shellcheck? What are some of the expected arguments?

Same with the other methods

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck_args is just arguments that get passed through to shellcheck. bazel_aquery is a Bazel aquery. I can try to mention these in comments.

"""Cleans up any genrule() outputs for the provided target(s).

This is useful for forcing genrule actions to re-run, because the _true_
outputs of those actions can include a larger set of files (e.g. files
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the case, the genrule is probably broken. Calling out where this happens in the BUILD.bazel would be helpful (so that it may at least be a caution, if not fixed, and preclean obviated)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The genrules are indeed "broken", but that has always been the case, and is unrelated to this PR. The reason is that we want to put the generated files into the worktree and Bazel inherently doesn't support this. There's no way to avoid the precleaning short of revamping the entire build flow and avoiding modifying the worktree (which I'm not against if it's possible, but is orthogonal to this PR).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't new logic btw. It's equivalent to what was already in the other shell script I deleted. I'm just moving it from Bash to Python to deduplicate the textproto parsing logic since I had to solve that problem in here in Python too.

# This flag formats individual files. --files *must* be the first command line
# arg to use this option.
if [[ "$1" == '--files' ]]; then
if [ "${1-}" == '--files' ]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want a getopt style loop here

Copy link
Copy Markdown
Contributor Author

@mehrdadn mehrdadn Jul 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate PR :-) I'm not not trying to change the logic or refactor these here, just linting scripts.


# Format all files, and print the diff to stdout for travis.
format_all() {
flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/,python/ray/thirdparty_files/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we set up a flake8 config instead of copying these ignore flags in many different places?

Copy link
Copy Markdown
Contributor Author

@mehrdadn mehrdadn Jul 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. Note that this isn't new logic though -- I just moved this line from the other file. I have no idea how to set up a flake8 config but it might be worth doing in a separate PR.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/29118/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/29135/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/29145/
Test FAILed.

Copy link
Copy Markdown
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you check that bazel.py is checked by the python linter? At the very least manually running it would be acceptable.

Comment on lines +204 to +205
i += 1
result = 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file checked by the linter? Should be a space here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to complain locally for me for some reason (even though other deliberate changes do seem to make it complain), but I added a space now regardless.

@edoakes edoakes merged commit a7b97b6 into ray-project:master Jul 30, 2020
@mehrdadn mehrdadn deleted the shellcheck branch July 30, 2020 23:40
@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/29188/
Test FAILed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants