From 4f470c3fc13b69f1947dd0b787f6df9f963c37ed Mon Sep 17 00:00:00 2001 From: mehrdadn Date: Tue, 21 Jul 2020 14:47:09 -0700 Subject: [PATCH] Shellcheck comments (#9595) --- ci/jenkins_tests/run_multi_node_tests.sh | 2 ++ ci/regression_test/rllib_stress_tests/run.sh | 1 + ci/travis/build-autoscaler-images.sh | 2 ++ ci/travis/ci.sh | 4 ++++ ci/travis/install-bazel.sh | 3 +++ ci/travis/iwyu.sh | 2 ++ doc/azure/azure-init.sh | 1 + doc/dev/bin/pip_download_test.sh | 2 ++ doc/dev/download_wheels.sh | 2 ++ doc/examples/lm/preprocess.sh | 2 ++ java/cleanup.sh | 3 +++ 11 files changed, 24 insertions(+) diff --git a/ci/jenkins_tests/run_multi_node_tests.sh b/ci/jenkins_tests/run_multi_node_tests.sh index c219fa648..23299a5a1 100755 --- a/ci/jenkins_tests/run_multi_node_tests.sh +++ b/ci/jenkins_tests/run_multi_node_tests.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # This file exists for Jenkins compatiblity ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) diff --git a/ci/regression_test/rllib_stress_tests/run.sh b/ci/regression_test/rllib_stress_tests/run.sh index 91229ca52..08af29763 100644 --- a/ci/regression_test/rllib_stress_tests/run.sh +++ b/ci/regression_test/rllib_stress_tests/run.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash source activate tensorflow_p36 diff --git a/ci/travis/build-autoscaler-images.sh b/ci/travis/build-autoscaler-images.sh index 85a41839a..87428aa44 100755 --- a/ci/travis/build-autoscaler-images.sh +++ b/ci/travis/build-autoscaler-images.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # This script build docker images for autoscaler. # For now, we only build python3.6 images. set -e diff --git a/ci/travis/ci.sh b/ci/travis/ci.sh index cb1076ec8..4a21afdf8 100755 --- a/ci/travis/ci.sh +++ b/ci/travis/ci.sh @@ -367,6 +367,7 @@ lint() { # Checkout a clean copy of the repo to avoid seeing changes that have been made to the current one ( WORKSPACE_DIR="$(TMPDIR="${WORKSPACE_DIR}/.." mktemp -d)" + # shellcheck disable=SC2030 ROOT_DIR="${WORKSPACE_DIR}"/ci/travis git worktree add -q "${WORKSPACE_DIR}" pushd "${WORKSPACE_DIR}" @@ -381,6 +382,7 @@ _check_job_triggers() { job_names="$1" local variable_definitions + # shellcheck disable=SC2031 variable_definitions=($(python "${ROOT_DIR}"/determine_tests_to_run.py)) if [ 0 -lt "${#variable_definitions[@]}" ]; then local expression restore_shell_state="" @@ -392,6 +394,7 @@ _check_job_triggers() { eval "${restore_shell_state}" "${expression}" # Restore set -x, then evaluate expression fi + # shellcheck disable=SC2086 if ! (set +x && should_run_job ${job_names//,/ }); then if [ "${GITHUB_ACTIONS-}" = true ]; then # If this job is to be skipped, emit 'exit' into .bashrc to quickly exit all following steps. @@ -433,6 +436,7 @@ init() { configure_system + # shellcheck disable=SC2031 . "${ROOT_DIR}"/install-dependencies.sh # Script is sourced to propagate up environment changes } diff --git a/ci/travis/install-bazel.sh b/ci/travis/install-bazel.sh index 138581931..3cd4534e8 100755 --- a/ci/travis/install-bazel.sh +++ b/ci/travis/install-bazel.sh @@ -86,6 +86,7 @@ if [ "${CI-}" = true ]; then # If we are in master build, we can write to the cache as well. upload=0 if [ "${TRAVIS_PULL_REQUEST-false}" = false ]; then + # shellcheck disable=SC2154 if [ -n "${BAZEL_CACHE_CREDENTIAL_B64:+x}" ]; then { printf "%s" "${BAZEL_CACHE_CREDENTIAL_B64}" | base64 -d - >> "${HOME}/bazel_cache_credential.json" @@ -93,11 +94,13 @@ if [ "${CI-}" = true ]; then upload=1 elif [ -n "${encrypted_1c30b31fe1ee_key:+x}" ]; then { + # shellcheck disable=SC2154 openssl aes-256-cbc -K "${encrypted_1c30b31fe1ee_key}" \ -iv "${encrypted_1c30b31fe1ee_iv}" \ -in "${ROOT_DIR}/bazel_cache_credential.json.enc" \ -out "${HOME}/bazel_cache_credential.json" -d } 2>&- # avoid printing secrets + # shellcheck disable=SC2181 if [ 0 -eq $? ]; then upload=1 fi diff --git a/ci/travis/iwyu.sh b/ci/travis/iwyu.sh index 85a797a89..db8ac1383 100755 --- a/ci/travis/iwyu.sh +++ b/ci/travis/iwyu.sh @@ -58,6 +58,7 @@ invoke_cc() { case "${cc##*/}" in clang*) # Call iwyu with the modified arguments and environment variables (env -i starts with a blank slate) + # shellcheck disable=SC2016 { 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 ' # Awk script to remove noise in the iwyu output { header = 0; } @@ -85,6 +86,7 @@ main() { data="$(exec sed -e "s/\(0x[0-9a-fA-F]*\)]\(,\a\)/\"\1\"]\2/g" -e "s/,\(\a\s*\(]\|\$\)\)/\1/g" -e "s/\a/\n/g" <<< "${data}")" # Parse the resulting JSON and select the actual fields we're interested in. # We put the environment variables first, separating them from the command-line arguments via '--'. + # shellcheck disable=SC1003 data="$(PATH="${PATH}:${MINGW_DIR-/usr}/bin" && exec jq -r '( [] + [.[1:][] | select (.[0] == 6) | "\(.[1][1])=\(.[2][1])" | gsub("'\''"; "'\''\\'\'''\''") | "'\''\(.)'\''"] diff --git a/doc/azure/azure-init.sh b/doc/azure/azure-init.sh index 5bbf5cea0..4875e789d 100755 --- a/doc/azure/azure-init.sh +++ b/doc/azure/azure-init.sh @@ -84,6 +84,7 @@ systemctl enable ray echo "Starting ray..." systemctl start ray +# shellcheck disable=SC2154 if [ "$type" = "head" ]; then echo "Configure TensorBoard to start at boot..." systemctl enable tensorboard diff --git a/doc/dev/bin/pip_download_test.sh b/doc/dev/bin/pip_download_test.sh index 75372fa68..69e9dcf71 100755 --- a/doc/dev/bin/pip_download_test.sh +++ b/doc/dev/bin/pip_download_test.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # This script automatically download ray and run the sanity check (sanity_check.py) # in various Python version. This script requires conda command to exist. diff --git a/doc/dev/download_wheels.sh b/doc/dev/download_wheels.sh index cec0df804..5aa7f00a6 100644 --- a/doc/dev/download_wheels.sh +++ b/doc/dev/download_wheels.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + if [[ -z "$RAY_HASH" ]]; then echo "RAY_HASH env var should be provided" exit 1 diff --git a/doc/examples/lm/preprocess.sh b/doc/examples/lm/preprocess.sh index bfc1a8a33..ceb6fd414 100644 --- a/doc/examples/lm/preprocess.sh +++ b/doc/examples/lm/preprocess.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + cd ~/efs/lm # download the dataset diff --git a/java/cleanup.sh b/java/cleanup.sh index b0f9897de..2c9521edd 100755 --- a/java/cleanup.sh +++ b/java/cleanup.sh @@ -1,6 +1,9 @@ +#!/usr/bin/env bash + # Stop backend processes ray stop # Kill Java workers +# shellcheck disable=SC2009 ps aux | grep DefaultWorker | grep -v grep | awk '{print $2}' | xargs kill -9 # Remove temp files rm -rf /tmp/ray