style: re-enable shellcheck.

Ensure that `shellcheck` is run by `brew style` again and fix the
various failures.
This commit is contained in:
Mike McQuaid 2020-07-07 11:53:55 +01:00
parent 99aee97856
commit 15a2abd9df
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
4 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ then
fi fi
# USER isn't always set so provide a fall back for `brew` and subprocesses. # USER isn't always set so provide a fall back for `brew` and subprocesses.
export USER=${USER:-`id -un`} export USER=${USER:-$(id -un)}
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local # Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY. # for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.

View File

@ -56,7 +56,7 @@ module Homebrew
File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH
end end
if files && !has_non_formula if files.present? && !has_non_formula
config = if files.first && File.exist?("#{files.first}/spec") config = if files.first && File.exist?("#{files.first}/spec")
HOMEBREW_LIBRARY/".rubocop_rspec.yml" HOMEBREW_LIBRARY/".rubocop_rspec.yml"
else else
@ -65,7 +65,7 @@ module Homebrew
args << "--config" << config args << "--config" << config
end end
if files.nil? if files.blank?
args << HOMEBREW_LIBRARY_PATH args << HOMEBREW_LIBRARY_PATH
else else
args += files args += files
@ -79,7 +79,7 @@ module Homebrew
when :print when :print
args << "--debug" if Homebrew.args.debug? args << "--debug" if Homebrew.args.debug?
args << "--display-cop-names" if Homebrew.args.display_cop_names? args << "--display-cop-names" if Homebrew.args.display_cop_names?
args << "--format" << "simple" if files args << "--format" << "simple" if files.present?
system(cache_env, "rubocop", *args) system(cache_env, "rubocop", *args)
rubocop_success = $CHILD_STATUS.success? rubocop_success = $CHILD_STATUS.success?
when :json when :json
@ -100,7 +100,7 @@ module Homebrew
raise "Invalid output_type for check_style_impl: #{output_type}" raise "Invalid output_type for check_style_impl: #{output_type}"
end end
return rubocop_success if files.present? || !has_non_formula return rubocop_success if files.present?
shellcheck = which("shellcheck") shellcheck = which("shellcheck")
shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"]) shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"])

View File

@ -44,7 +44,7 @@ If there's no Homebrew Portable Ruby available for your processor:
then then
HOMEBREW_RUBY_PATH="$vendor_ruby_path" HOMEBREW_RUBY_PATH="$vendor_ruby_path"
[[ -z "$HOMEBREW_MACOS" ]] && TERMINFO_DIRS="$vendor_ruby_terminfo" [[ -z "$HOMEBREW_MACOS" ]] && TERMINFO_DIRS="$vendor_ruby_terminfo"
if [[ $vendor_ruby_current_version != $vendor_ruby_latest_version ]] if [[ $vendor_ruby_current_version != "$vendor_ruby_latest_version" ]]
then then
if ! brew vendor-install ruby if ! brew vendor-install ruby
then then

View File

@ -23,8 +23,8 @@ symlink_target_directory() {
builtin enable compgen unset builtin enable compgen unset
for cmd in $(builtin compgen -A builtin) for cmd in $(builtin compgen -A builtin)
do do
builtin unset -f $cmd builtin unset -f "$cmd"
builtin enable $cmd builtin enable "$cmd"
done done
unset cmd unset cmd