-
Notifications
You must be signed in to change notification settings - Fork 249
Closed
Description
Is your feature request related to a problem? Please describe.
In reviewing the documentation and setup/install scripts I noticed numerous issues in the Bash scripts that could lead to problems/bugs.
ShellCheck is a useful linting tool which can help catch and report them.
e.g. for $ shellcheck scripts/pulsar/prepare_helm_release.sh it reports the following issues:
In scripts/pulsar/prepare_helm_release.sh line 21:
CHART_HOME=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/../.. && pwd)
^----------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In scripts/pulsar/prepare_helm_release.sh line 22:
cd ${CHART_HOME}
^--------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
cd "${CHART_HOME}" || exit
In scripts/pulsar/prepare_helm_release.sh line 100:
kubectl create namespace ${namespace} ${local:+ -o yaml --dry-run=client}
^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
kubectl create namespace "${namespace}" ${local:+ -o yaml --dry-run=client}
In scripts/pulsar/prepare_helm_release.sh line 107:
if [ $? -ne 0 ]; then
^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.
In scripts/pulsar/prepare_helm_release.sh line 124:
${CHART_HOME}/scripts/pulsar/generate_token_secret_key.sh -n ${namespace} -k ${release} ${extra_opts}
^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
"${CHART_HOME}"/scripts/pulsar/generate_token_secret_key.sh -n "${namespace}" -k "${release}" "${extra_opts}"
In scripts/pulsar/prepare_helm_release.sh line 133:
${CHART_HOME}/scripts/pulsar/generate_token.sh -n ${namespace} -k ${release} -r ${user} ${extra_opts}
^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.
^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
"${CHART_HOME}"/scripts/pulsar/generate_token.sh -n "${namespace}" -k "${release}" -r "${user}" "${extra_opts}"
For more information:
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
https://www.shellcheck.net/wiki/SC2164 -- Use 'cd ... || exit' or 'cd ... |...
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
Describe the solution you'd like
There are GitHub Actions available which run ShellCheck on every Pull Request to help keep the Bash scripts clean and bug-free moving forward.
e.g.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels