Mike McQuaid 7af68d0f8e
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
2021-04-22 13:18:44 +01:00

27 lines
855 B
Bash

#: * `rubocop`
#:
#: Installs, configures and runs Homebrew's `rubocop`.
# HOMEBREW_LIBRARY is from the user environment.
# HOMEBREW_RUBY_PATH is set by utils/ruby.sh
# RUBY_DISABLE_OPTIONS is set by brew.sh
# HOMEBREW_BREW_FILE is set by extend/ENV/super.rb
# shellcheck disable=SC2154
homebrew-rubocop() {
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
setup-ruby-path
GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')"
GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}"
if ! [[ -f "${GEM_HOME}/bin/rubocop" ]]; then
"${HOMEBREW_BREW_FILE}" install-bundler-gems
fi
export GEM_HOME
export PATH="${GEM_HOME}/bin:${PATH}"
RUBOCOP="${HOMEBREW_LIBRARY}/Homebrew/utils/rubocop.rb"
exec "${HOMEBREW_RUBY_PATH}" "${RUBOCOP}" "$@"
}