diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index d7d6f8b2f2..e2875794a7 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -51,9 +51,9 @@ HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}" HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}" HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}" -# These referenced variables are set by bin/brew # Don't need to handle a default case. -# shellcheck disable=SC2154,SC2249 +# HOMEBREW_LIBRARY set by bin/brew +# shellcheck disable=SC2249,SC2154 case "$*" in --cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;; --repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;; @@ -315,6 +315,8 @@ then fi HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" +# Used in --version.sh +# shellcheck disable=SC2034 HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" case "$*" in diff --git a/Library/Homebrew/cmd/formulae.sh b/Library/Homebrew/cmd/formulae.sh index eee27c9629..ccf04ea076 100644 --- a/Library/Homebrew/cmd/formulae.sh +++ b/Library/Homebrew/cmd/formulae.sh @@ -3,7 +3,9 @@ #: List all locally installable formulae including short names. #: -source "$HOMEBREW_LIBRARY/Homebrew/items.sh" +# HOMEBREW_LIBRARY is set by bin/brew +# shellcheck disable=SC2154 +source "${HOMEBREW_LIBRARY}/Homebrew/items.sh" homebrew-formulae() { homebrew-items 'Casks' 's|/Formula/|/|' '^homebrew/core' diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 6d1e74f1ed..17f9c7903f 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -444,6 +444,8 @@ EOS QUIET_ARGS=() fi + # HOMEBREW_CURLRC isn't misspelt here + # shellcheck disable=SC2153 if [[ -z "${HOMEBREW_CURLRC}" ]] then CURL_DISABLE_CURLRC_ARGS=(-q) diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index be4293183f..6c5d4878ab 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -82,6 +82,8 @@ fetch() { curl_args=() # do not load .curlrc unless requested (must be the first argument) + # HOMEBREW_CURLRC isn't misspelt here + # shellcheck disable=SC2153 if [[ -z "${HOMEBREW_CURLRC}" ]] then curl_args[${#curl_args[*]}]="-q" diff --git a/Library/Homebrew/completions/bash.erb b/Library/Homebrew/completions/bash.erb index dfe77a08a9..71a72e6624 100644 --- a/Library/Homebrew/completions/bash.erb +++ b/Library/Homebrew/completions/bash.erb @@ -138,32 +138,32 @@ _brew() { local i=1 cmd # find the subcommand - while [[ "$i" -lt "$COMP_CWORD" ]] + while [[ "${i}" -lt "${COMP_CWORD}" ]] do local s="${COMP_WORDS[i]}" - case "$s" in + case "${s}" in --*) - cmd="$s" + cmd="${s}" break ;; -*) ;; *) - cmd="$s" + cmd="${s}" break ;; esac (( i++ )) done - if [[ "$i" -eq "$COMP_CWORD" ]] + if [[ "${i}" -eq "${COMP_CWORD}" ]] then __brew_complete_commands return fi # subcommands have their own completion functions - case "$cmd" in + case "${cmd}" in <%= function_mappings.join("\n ").concat("\n") %> *) ;; esac diff --git a/completions/bash/brew b/completions/bash/brew index 85828ae500..68f056f099 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -2389,32 +2389,32 @@ _brew() { local i=1 cmd # find the subcommand - while [[ "$i" -lt "$COMP_CWORD" ]] + while [[ "${i}" -lt "${COMP_CWORD}" ]] do local s="${COMP_WORDS[i]}" - case "$s" in + case "${s}" in --*) - cmd="$s" + cmd="${s}" break ;; -*) ;; *) - cmd="$s" + cmd="${s}" break ;; esac (( i++ )) done - if [[ "$i" -eq "$COMP_CWORD" ]] + if [[ "${i}" -eq "${COMP_CWORD}" ]] then __brew_complete_commands return fi # subcommands have their own completion functions - case "$cmd" in + case "${cmd}" in --cache) _brew___cache ;; --caskroom) _brew___caskroom ;; --cellar) _brew___cellar ;;