mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Run shellcheck
on cask utils and shim scripts.
This commit is contained in:
parent
5aa0dbe1f9
commit
c2c93d1cc9
@ -7,7 +7,7 @@ pathremove() {
|
||||
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
|
||||
fi
|
||||
done
|
||||
export $PATHVARIABLE="$NEWPATH"
|
||||
export "$PATHVARIABLE"="$NEWPATH"
|
||||
}
|
||||
|
||||
if [[ -n "$HOMEBREW_MAKE" && "$HOMEBREW_MAKE" != "make" ]]
|
||||
@ -16,7 +16,8 @@ then
|
||||
else
|
||||
SAVED_PATH="$PATH"
|
||||
pathremove "$HOMEBREW_LIBRARY/Homebrew/shims/linux/super"
|
||||
export MAKE="$(which make)"
|
||||
MAKE="$(which make)"
|
||||
export MAKE
|
||||
export PATH="$SAVED_PATH"
|
||||
fi
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# System Ruby's mkmf on Mojave (10.14) and later require SDKROOT set to work correctly.
|
||||
|
||||
# Don't need shellcheck to follow the `source`.
|
||||
# shellcheck disable=SC1090
|
||||
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
||||
|
||||
try_exec_non_system "$SHIM_FILE" "$@"
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Historically, xcrun has had various bugs, and in some cases it didn't
|
||||
# work at all (e.g. CLT-only in the Xcode 4.3 era). This script emulates
|
||||
# it and attempts to avoid these issues.
|
||||
@ -27,10 +28,10 @@ arg0=$1
|
||||
shift
|
||||
|
||||
exe="/usr/bin/${arg0}"
|
||||
if [ -x "$exe" ]; then
|
||||
if [ -n "$HOMEBREW_PREFER_CLT_PROXIES" ]; then
|
||||
if [[ -x "$exe" ]]; then
|
||||
if [[ -n "$HOMEBREW_PREFER_CLT_PROXIES" ]]; then
|
||||
exec "$exe" "$@"
|
||||
elif [ -z "$HOMEBREW_SDKROOT" -o ! -d "$HOMEBREW_SDKROOT" ]; then
|
||||
elif [[ -z "$HOMEBREW_SDKROOT" || ! -d "$HOMEBREW_SDKROOT" ]]; then
|
||||
exec "$exe" "$@"
|
||||
fi
|
||||
fi
|
||||
@ -38,7 +39,7 @@ fi
|
||||
SUPERBIN=$(cd "${0%/*}" && pwd -P)
|
||||
|
||||
exe=$(/usr/bin/xcrun --find "$arg0" 2>/dev/null)
|
||||
if [ -x "$exe" -a "${exe%/*}" != "$SUPERBIN" ]; then
|
||||
if [[ -x "$exe" && "${exe%/*}" != "$SUPERBIN" ]]; then
|
||||
exec "$exe" "$@"
|
||||
fi
|
||||
|
||||
@ -57,7 +58,7 @@ done
|
||||
IFS=$old_IFS
|
||||
|
||||
echo >&2 "
|
||||
Failed to execute $arg0 $@
|
||||
Failed to execute ${arg0} ${*}
|
||||
|
||||
Xcode and/or the CLT appear to be misconfigured. Try one or both of the following:
|
||||
xcodebuild -license
|
||||
|
@ -9,6 +9,8 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Don't need shellcheck to follow the `source`.
|
||||
# shellcheck disable=SC1090
|
||||
source "$HOMEBREW_LIBRARY/Homebrew/shims/utils.sh"
|
||||
|
||||
case "$(lowercase "$SHIM_FILE")" in
|
||||
|
@ -60,8 +60,10 @@ safe_exec() {
|
||||
fi
|
||||
if [[ "$HOMEBREW" = "print-path" ]]
|
||||
then
|
||||
local dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
||||
local path="$(dirbasepath "$dir" "$arg0")"
|
||||
local dir
|
||||
dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
|
||||
local path
|
||||
path="$(dirbasepath "$dir" "$arg0")"
|
||||
echo "$path"
|
||||
exit
|
||||
fi
|
||||
|
@ -177,13 +177,16 @@ module Homebrew
|
||||
files = [
|
||||
HOMEBREW_BREW_FILE,
|
||||
# TODO: HOMEBREW_REPOSITORY/"completions/bash/brew",
|
||||
*Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/*.sh"),
|
||||
*Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/cmd/*.sh"),
|
||||
*Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/utils/*.sh"),
|
||||
*HOMEBREW_LIBRARY.glob("Homebrew/*.sh"),
|
||||
*HOMEBREW_LIBRARY.glob("Homebrew/shims/**/*").map(&:realpath).uniq
|
||||
.reject { |path| path.directory? || path.basename.to_s == "cc" },
|
||||
*HOMEBREW_LIBRARY.glob("Homebrew/{dev-,}cmd/*.sh"),
|
||||
*HOMEBREW_LIBRARY.glob("Homebrew/{cask/,}utils/*.sh"),
|
||||
]
|
||||
end
|
||||
|
||||
args = ["--shell=bash", "--", *files] # TODO: Add `--enable=all` to check for more problems.
|
||||
# TODO: Add `--enable=all` to check for more problems.
|
||||
args = ["--shell=bash", "--external-sources", "--", *files]
|
||||
|
||||
case output_type
|
||||
when :print
|
||||
|
Loading…
x
Reference in New Issue
Block a user