mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix shellcheck failures
A new version of `shellcheck` (I think?) brought us so new warnings and errors. To fix: - pass `--source-path` so we don't need to stop `shellcheck` trying to read sourced files every time - disable some more warnings/errors we don't care about fixing
This commit is contained in:
parent
813f75159b
commit
7af68d0f8e
@ -51,10 +51,9 @@ HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
|
|||||||
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
|
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
|
||||||
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
|
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
|
||||||
|
|
||||||
# Don't need shellcheck to follow these `source`.
|
|
||||||
# These referenced variables are set by bin/brew
|
# These referenced variables are set by bin/brew
|
||||||
# Don't need to handle a default case.
|
# Don't need to handle a default case.
|
||||||
# shellcheck disable=SC1090,SC2154,SC2249
|
# shellcheck disable=SC2154,SC2249
|
||||||
case "$*" in
|
case "$*" in
|
||||||
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
|
--cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
|
||||||
--repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
|
--repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
|
||||||
@ -317,8 +316,6 @@ fi
|
|||||||
|
|
||||||
HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core"
|
HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core"
|
||||||
|
|
||||||
# Don't need shellcheck to follow these `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
case "$*" in
|
case "$*" in
|
||||||
--version|-v) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"; homebrew-version; exit 0 ;;
|
--version|-v) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"; homebrew-version; exit 0 ;;
|
||||||
esac
|
esac
|
||||||
@ -648,8 +645,6 @@ access to all bottles."
|
|||||||
EOS
|
EOS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't need shellcheck to follow this `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/utils/analytics.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/utils/analytics.sh"
|
||||||
setup-analytics
|
setup-analytics
|
||||||
|
|
||||||
@ -660,13 +655,11 @@ then
|
|||||||
# a Ruby script and avoids hard-to-debug issues if the Bash script is updated
|
# a Ruby script and avoids hard-to-debug issues if the Bash script is updated
|
||||||
# at the same time as being run.
|
# at the same time as being run.
|
||||||
#
|
#
|
||||||
# Don't need shellcheck to follow this `source`.
|
# Shellcheck can't follow this dynamic `source`.
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${HOMEBREW_BASH_COMMAND}"
|
source "${HOMEBREW_BASH_COMMAND}"
|
||||||
{ update-preinstall "$@"; "homebrew-${HOMEBREW_COMMAND}" "$@"; exit $?; }
|
{ update-preinstall "$@"; "homebrew-${HOMEBREW_COMMAND}" "$@"; exit $?; }
|
||||||
else
|
else
|
||||||
# Don't need shellcheck to follow this `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
||||||
setup-ruby-path
|
setup-ruby-path
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#: List all locally installable casks including short names.
|
#: List all locally installable casks including short names.
|
||||||
#:
|
#:
|
||||||
|
|
||||||
# Don't need shellcheck to follow the `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/items.sh"
|
source "$HOMEBREW_LIBRARY/Homebrew/items.sh"
|
||||||
|
|
||||||
homebrew-casks() {
|
homebrew-casks() {
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#: List all locally installable formulae including short names.
|
#: List all locally installable formulae including short names.
|
||||||
#:
|
#:
|
||||||
|
|
||||||
# Don't need shellcheck to follow the `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/items.sh"
|
source "$HOMEBREW_LIBRARY/Homebrew/items.sh"
|
||||||
|
|
||||||
homebrew-formulae() {
|
homebrew-formulae() {
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
#: -d, --debug Display a trace of all shell commands as they are executed.
|
#: -d, --debug Display a trace of all shell commands as they are executed.
|
||||||
#: -h, --help Show this message.
|
#: -h, --help Show this message.
|
||||||
|
|
||||||
# Don't need shellcheck to follow this `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
|
source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
|
||||||
|
|
||||||
# Replaces the function in Library/Homebrew/brew.sh to cache the Git executable to
|
# Replaces the function in Library/Homebrew/brew.sh to cache the Git executable to
|
||||||
@ -522,6 +520,9 @@ EOS
|
|||||||
# the refspec ensures that the default upstream branch gets updated
|
# the refspec ensures that the default upstream branch gets updated
|
||||||
(
|
(
|
||||||
UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)"
|
UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)"
|
||||||
|
|
||||||
|
# HOMEBREW_UPDATE_FORCE and HOMEBREW_UPDATE_PREINSTALL aren't modified here so ignore subshell warning.
|
||||||
|
# shellcheck disable=SC2030
|
||||||
if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]]
|
if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]]
|
||||||
then
|
then
|
||||||
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"
|
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"
|
||||||
@ -542,6 +543,8 @@ EOS
|
|||||||
GITHUB_API_ENDPOINT="commits/$UPSTREAM_BRANCH_DIR"
|
GITHUB_API_ENDPOINT="commits/$UPSTREAM_BRANCH_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# HOMEBREW_CURL is set by brew.sh (and isn't mispelt here)
|
||||||
|
# shellcheck disable=SC2153
|
||||||
UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" \
|
UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" \
|
||||||
"${CURL_DISABLE_CURLRC_ARGS[@]}" \
|
"${CURL_DISABLE_CURLRC_ARGS[@]}" \
|
||||||
--silent --max-time 3 \
|
--silent --max-time 3 \
|
||||||
@ -565,6 +568,9 @@ EOS
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# HOMEBREW_VERBOSE isn't modified here so ignore subshell warning.
|
||||||
|
# shellcheck disable=SC2030
|
||||||
if [[ -n "$HOMEBREW_VERBOSE" ]]
|
if [[ -n "$HOMEBREW_VERBOSE" ]]
|
||||||
then
|
then
|
||||||
echo "Fetching $DIR..."
|
echo "Fetching $DIR..."
|
||||||
@ -636,6 +642,8 @@ EOS
|
|||||||
PREFETCH_REVISION="${!PREFETCH_REVISION_VAR}"
|
PREFETCH_REVISION="${!PREFETCH_REVISION_VAR}"
|
||||||
POSTFETCH_REVISION="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")"
|
POSTFETCH_REVISION="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")"
|
||||||
|
|
||||||
|
# HOMEBREW_UPDATE_FORCE and HOMEBREW_VERBOSE weren't modified in subshell.
|
||||||
|
# shellcheck disable=SC2031
|
||||||
if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
|
if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
|
||||||
then
|
then
|
||||||
simulate_from_current_branch "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH" "$CURRENT_REVISION"
|
simulate_from_current_branch "$DIR" "$TAP_VAR" "$UPSTREAM_BRANCH" "$CURRENT_REVISION"
|
||||||
@ -653,6 +661,8 @@ EOS
|
|||||||
|
|
||||||
safe_cd "$HOMEBREW_REPOSITORY"
|
safe_cd "$HOMEBREW_REPOSITORY"
|
||||||
|
|
||||||
|
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
|
||||||
|
# shellcheck disable=SC2031
|
||||||
if [[ -n "$HOMEBREW_UPDATED" ||
|
if [[ -n "$HOMEBREW_UPDATED" ||
|
||||||
-n "$HOMEBREW_UPDATE_FAILED" ||
|
-n "$HOMEBREW_UPDATE_FAILED" ||
|
||||||
-n "$HOMEBREW_FAILED_FETCH_DIRS" ||
|
-n "$HOMEBREW_FAILED_FETCH_DIRS" ||
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#:
|
#:
|
||||||
#: Install Homebrew's portable Ruby.
|
#: Install Homebrew's portable Ruby.
|
||||||
|
|
||||||
# Don't need shellcheck to follow this `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
|
source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
|
||||||
|
|
||||||
VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor"
|
VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor"
|
||||||
@ -119,6 +117,8 @@ fetch() {
|
|||||||
else
|
else
|
||||||
if [[ -f "$temporary_path" ]]
|
if [[ -f "$temporary_path" ]]
|
||||||
then
|
then
|
||||||
|
# HOMEBREW_CURL is set by brew.sh (and isn't mispelt here)
|
||||||
|
# shellcheck disable=SC2153
|
||||||
"$HOMEBREW_CURL" "${curl_args[@]}" -C - "$VENDOR_URL" -o "$temporary_path"
|
"$HOMEBREW_CURL" "${curl_args[@]}" -C - "$VENDOR_URL" -o "$temporary_path"
|
||||||
if [[ $? -eq 33 ]]
|
if [[ $? -eq 33 ]]
|
||||||
then
|
then
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
# HOMEBREW_BREW_FILE is set by extend/ENV/super.rb
|
# HOMEBREW_BREW_FILE is set by extend/ENV/super.rb
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
homebrew-rubocop() {
|
homebrew-rubocop() {
|
||||||
# Don't need shellcheck to follow this `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
|
||||||
setup-ruby-path
|
setup-ruby-path
|
||||||
|
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
# System Ruby's mkmf on Mojave (10.14) and later require SDKROOT set to work correctly.
|
# System Ruby's mkmf on Mojave (10.14) and later require SDKROOT set to work correctly.
|
||||||
|
|
||||||
# Don't need shellcheck to follow the `source`.
|
|
||||||
# HOMEBREW_LIBRARY is set by bin/brew
|
# HOMEBREW_LIBRARY is set by bin/brew
|
||||||
# HOMEBREW_SDKROOT is set by extend/ENV/super.rb
|
# HOMEBREW_SDKROOT is set by extend/ENV/super.rb
|
||||||
# shellcheck disable=SC1090,SC2154
|
# shellcheck disable=SC2154
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
||||||
|
|
||||||
try_exec_non_system "${SHIM_FILE}" "$@"
|
try_exec_non_system "${SHIM_FILE}" "$@"
|
||||||
|
@ -15,8 +15,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't need shellcheck to follow the `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
|
||||||
|
|
||||||
# shellcheck disable=SC2249
|
# shellcheck disable=SC2249
|
||||||
|
@ -186,7 +186,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
# TODO: Add `--enable=all` to check for more problems.
|
# TODO: Add `--enable=all` to check for more problems.
|
||||||
args = ["--shell=bash", "--external-sources", "--", *files]
|
args = ["--shell=bash", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files]
|
||||||
|
|
||||||
case output_type
|
case output_type
|
||||||
when :print
|
when :print
|
||||||
|
2
bin/brew
2
bin/brew
@ -121,7 +121,5 @@ then
|
|||||||
else
|
else
|
||||||
echo "Warning: HOMEBREW_NO_ENV_FILTERING is undocumented, deprecated and will be removed in a future Homebrew release (because it breaks many things)!" >&2
|
echo "Warning: HOMEBREW_NO_ENV_FILTERING is undocumented, deprecated and will be removed in a future Homebrew release (because it breaks many things)!" >&2
|
||||||
|
|
||||||
# Don't need shellcheck to follow this `source`.
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${HOMEBREW_LIBRARY}/Homebrew/brew.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/brew.sh"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user