From cf7def0c68903814c6b4e04a55fe8f3cb3f5605e Mon Sep 17 00:00:00 2001 From: XuehaiPan Date: Sun, 7 Nov 2021 21:21:42 +0800 Subject: [PATCH 1/2] style: apply shellcheck autofix --- Library/Homebrew/cmd/update.sh | 2 +- Library/Homebrew/completions/bash.erb | 2 +- bin/brew | 1 + completions/bash/brew | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 0f9b6355f4..8dd610a604 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -657,7 +657,7 @@ EOS if [[ "${UPSTREAM_SHA_HTTP_CODE}" == "404" ]] then - TAP="${DIR#${HOMEBREW_LIBRARY}/Taps/}" + TAP="${DIR#"${HOMEBREW_LIBRARY}"/Taps/}" echo "${TAP} does not exist! Run \`brew untap ${TAP}\` to remove it." >>"${update_failed_file}" else echo "Fetching ${DIR} failed!" >>"${update_failed_file}" diff --git a/Library/Homebrew/completions/bash.erb b/Library/Homebrew/completions/bash.erb index 71a72e6624..b9f52a2cd9 100644 --- a/Library/Homebrew/completions/bash.erb +++ b/Library/Homebrew/completions/bash.erb @@ -105,7 +105,7 @@ __brew_complete_tapped() { for dir in "${taplib}"/*/* do [[ -d "${dir}" ]] || continue - dir="${dir#${taplib}/}" + dir="${dir#"${taplib}"/}" dir="${dir/homebrew-/}" taps="${taps} ${dir}" done diff --git a/bin/brew b/bin/brew index ac635ce4f4..1c8fe3c6e3 100755 --- a/bin/brew +++ b/bin/brew @@ -2,6 +2,7 @@ # Fail fast with concise message when not using bash # Single brackets is needed here for POSIX compatibility +# shellcheck disable=SC2292 if [ -z "${BASH_VERSION:-}" ] then echo "Error: Bash is required to run brew." >&2 diff --git a/completions/bash/brew b/completions/bash/brew index 55b139d0ac..561175ff3e 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -92,7 +92,7 @@ __brew_complete_tapped() { for dir in "${taplib}"/*/* do [[ -d "${dir}" ]] || continue - dir="${dir#${taplib}/}" + dir="${dir#"${taplib}"/}" dir="${dir/homebrew-/}" taps="${taps} ${dir}" done From 98c082ca946597557ddd915d19da1376b502400d Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 8 Nov 2021 03:11:39 +0000 Subject: [PATCH 2/2] style: ignore SC2310-2312 for now --- Library/Homebrew/style.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 872004000c..c240798dfb 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -167,7 +167,16 @@ module Homebrew def run_shellcheck(files, output_type) files = shell_scripts if files.blank? - args = ["--shell=bash", "--enable=all", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files] + args = [ + "--shell=bash", + "--enable=all", + "--external-sources", + "--source-path=#{HOMEBREW_LIBRARY}", + # TODO: fix these + "--exclude=SC2310,SC2311,SC2312", + "--", + *files, + ] case output_type when :print