Merge pull request #11348 from GauthamGoli/shellcheck-enable-all

Fix `shellcheck` style errors and also Show `shellcheck` warnings in `brew style` results
This commit is contained in:
Mike McQuaid 2021-05-19 10:52:18 +01:00 committed by GitHub
commit ec2271cea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 17 deletions

View File

@ -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

View File

@ -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'

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -185,8 +185,7 @@ module Homebrew
]
end
# TODO: Add `--enable=all` to check for more problems.
args = ["--shell=bash", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files]
args = ["--shell=bash", "--enable=all", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files]
case output_type
when :print

View File

@ -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 ;;