From 6255263b51f759698a7f111f5313ffb4f39b11d3 Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Sat, 2 Aug 2025 23:27:59 -0400 Subject: [PATCH] output: express environment variables consistently --- Library/Homebrew/bundle/commands/exec.rb | 2 +- Library/Homebrew/cask/cask.rb | 2 +- Library/Homebrew/cask/installer.rb | 10 +++---- Library/Homebrew/cleanup.rb | 8 +++--- Library/Homebrew/cmd/deps.rb | 2 +- Library/Homebrew/cmd/desc.rb | 2 +- Library/Homebrew/cmd/gist-logs.rb | 4 ++- Library/Homebrew/cmd/readall.rb | 2 +- Library/Homebrew/cmd/search.rb | 2 +- Library/Homebrew/cmd/uninstall.rb | 4 +-- Library/Homebrew/cmd/update-report.rb | 8 +++--- Library/Homebrew/cmd/update-reset.sh | 4 ++- Library/Homebrew/cmd/update.sh | 4 +-- Library/Homebrew/cmd/uses.rb | 2 +- Library/Homebrew/dev-cmd/audit.rb | 2 +- Library/Homebrew/dev-cmd/bump.rb | 2 +- .../dev-cmd/determine-test-runners.rb | 2 +- Library/Homebrew/dev-cmd/formula-analytics.rb | 6 ++--- Library/Homebrew/dev-cmd/pr-pull.rb | 2 +- Library/Homebrew/dev-cmd/sh.rb | 2 +- Library/Homebrew/dev-cmd/unbottled.rb | 4 +-- Library/Homebrew/diagnostic.rb | 2 +- Library/Homebrew/download_strategy.rb | 2 +- Library/Homebrew/exceptions.rb | 4 +-- Library/Homebrew/extend/kernel.rb | 4 +-- .../Homebrew/extend/os/linux/diagnostic.rb | 6 ++--- Library/Homebrew/formula.rb | 4 +-- Library/Homebrew/formula_installer.rb | 26 +++++++++---------- Library/Homebrew/formulary.rb | 2 +- Library/Homebrew/rubocops/text.rb | 2 +- Library/Homebrew/services/system.rb | 4 +-- Library/Homebrew/startup/bootsnap.rb | 2 +- Library/Homebrew/system_command.rb | 4 ++- Library/Homebrew/tap.rb | 8 +++--- Library/Homebrew/test/cmd/desc_spec.rb | 2 +- .../Homebrew/test/test_runner_formula_spec.rb | 2 +- Library/Homebrew/test/utils/curl_spec.rb | 2 +- Library/Homebrew/upgrade.rb | 6 ++--- Library/Homebrew/utils/github.rb | 4 +-- Library/Homebrew/utils/github/api.rb | 2 +- completions/fish/brew.fish | 2 +- completions/zsh/_brew | 2 +- 42 files changed, 87 insertions(+), 81 deletions(-) diff --git a/Library/Homebrew/bundle/commands/exec.rb b/Library/Homebrew/bundle/commands/exec.rb index b6c698ff28..27d89cb193 100644 --- a/Library/Homebrew/bundle/commands/exec.rb +++ b/Library/Homebrew/bundle/commands/exec.rb @@ -180,7 +180,7 @@ module Homebrew <<~EOS Your shell has been configured to use a build environment from your `Brewfile`. This should help you build stuff. - Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). + Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`). When done, type `exit`. EOS end diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index b59b876072..6997ded4bb 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -32,7 +32,7 @@ module Cask def self.all(eval_all: false) if !eval_all && !Homebrew::EnvConfig.eval_all? - raise ArgumentError, "Cask::Cask#all cannot be used without `--eval-all` or HOMEBREW_EVAL_ALL" + raise ArgumentError, "Cask::Cask#all cannot be used without `--eval-all` or `HOMEBREW_EVAL_ALL=1`" end # Load core casks from tokens so they load from the API when the core cask is not tapped. diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 7af7bbfb6b..cb91c6513f 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -248,7 +248,7 @@ on_request: true) raise CaskError, <<~EOS Cask '#{@cask}' does not have a sha256 checksum defined and was not installed. - This means you have the #{Formatter.identifier("--require-sha")} option set, perhaps in your HOMEBREW_CASK_OPTS. + This means you have the #{Formatter.identifier("--require-sha")} option set, perhaps in your `$HOMEBREW_CASK_OPTS`. EOS end @@ -703,9 +703,9 @@ on_request: true) dep_full_name = cask_or_formula.full_name error_message = "The installation of #{@cask} has a dependency #{dep_full_name}\n" \ "from the #{dep_tap} tap but #{owner} " - error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env? + error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env? error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env? - error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env? + error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env? error_message << ".#{owner_contact}" raise CaskCannotBeInstalledError.new(@cask, error_message) @@ -717,9 +717,9 @@ on_request: true) error_message = "The installation of #{@cask.full_name} has the tap #{cask_tap}\n" \ "but #{owner} " - error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless cask_tap.allowed_by_env? + error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless cask_tap.allowed_by_env? error_message << " and\n" if !cask_tap.allowed_by_env? && cask_tap.forbidden_by_env? - error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if cask_tap.forbidden_by_env? + error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if cask_tap.forbidden_by_env? error_message << ".#{owner_contact}" raise CaskCannotBeInstalledError.new(@cask, error_message) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 0798ff30c4..7f879e044e 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -258,8 +258,8 @@ module Homebrew return if Homebrew::EnvConfig.no_env_hints? return if Homebrew::EnvConfig.no_install_cleanup? - puts "Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP." - puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)." + puts "Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`." + puts "Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`)." end def self.puts_no_install_cleanup_disable_message_if_not_already! @@ -315,8 +315,8 @@ module Homebrew end if ENV["HOMEBREW_AUTOREMOVE"].present? - opoo "HOMEBREW_AUTOREMOVE is now a no-op as it is the default behaviour. " \ - "Set HOMEBREW_NO_AUTOREMOVE=1 to disable it." + opoo "`$HOMEBREW_AUTOREMOVE` is now a no-op as it is the default behaviour. " \ + "Set `HOMEBREW_NO_AUTOREMOVE=1` to disable it." end Cleanup.autoremove(dry_run: dry_run?) unless Homebrew::EnvConfig.no_autoremove? diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 5506093641..fab4a5bbf6 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -130,7 +130,7 @@ module Homebrew opoo <<~EOS `brew deps` is not the actual runtime dependencies because #{not_using_runtime_dependencies_reason}! This means dependencies may differ from a formula's declared dependencies. - Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). + Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`). EOS end diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index 72d73a6a1c..3870653034 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -49,7 +49,7 @@ module Homebrew if search_type.present? if !args.eval_all? && Homebrew::EnvConfig.no_install_from_api? - raise UsageError, "`brew desc --search` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!" + raise UsageError, "`brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!" end query = args.named.join(" ") diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 54d7e3e3fc..63628d4e36 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -63,7 +63,9 @@ module Homebrew files["00.tap.out"] = { content: tap } end - odie "`brew gist-logs` requires HOMEBREW_GITHUB_API_TOKEN to be set!" if GitHub::API.credentials_type == :none + if GitHub::API.credentials_type == :none + odie "`brew gist-logs` requires `$HOMEBREW_GITHUB_API_TOKEN` to be set!" + end # Description formatted to work well as page title when viewing gist descr = if formula.core_formula? diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index c38beaaceb..5bc2ba512c 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -50,7 +50,7 @@ module Homebrew taps = if args.no_named? unless args.eval_all? - raise UsageError, "`brew readall` needs a tap or `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!" + raise UsageError, "`brew readall` needs a tap or `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!" end Tap.installed diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index e5bcda9e18..18ee98916d 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -72,7 +72,7 @@ module Homebrew if args.desc? if !args.eval_all? && Homebrew::EnvConfig.no_install_from_api? - raise UsageError, "`brew search --desc` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!" + raise UsageError, "`brew search --desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!" end Search.search_descriptions(string_or_regex, args) diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index ff1aafadbc..01ff5e7432 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -78,8 +78,8 @@ module Homebrew end if ENV["HOMEBREW_AUTOREMOVE"].present? - opoo "HOMEBREW_AUTOREMOVE is now a no-op as it is the default behaviour. " \ - "Set HOMEBREW_NO_AUTOREMOVE=1 to disable it." + opoo "`$HOMEBREW_AUTOREMOVE` is now a no-op as it is the default behaviour. " \ + "Set `HOMEBREW_NO_AUTOREMOVE=1` to disable it." end Cleanup.autoremove unless Homebrew::EnvConfig.no_autoremove? end diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index c74b725e7e..38c84d2e02 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -56,7 +56,7 @@ module Homebrew if Homebrew::EnvConfig.core_git_remote != HOMEBREW_CORE_DEFAULT_GIT_REMOTE opoo <<~EOS - HOMEBREW_CORE_GIT_REMOTE was set: #{Homebrew::EnvConfig.core_git_remote}. + `$HOMEBREW_CORE_GIT_REMOTE` was set: #{Homebrew::EnvConfig.core_git_remote}. It has been unset for the migration. You may need to change this from a linuxbrew-core mirror to a homebrew-core one. @@ -66,7 +66,7 @@ module Homebrew if Homebrew::EnvConfig.bottle_domain != HOMEBREW_BOTTLE_DEFAULT_DOMAIN opoo <<~EOS - HOMEBREW_BOTTLE_DOMAIN was set: #{Homebrew::EnvConfig.bottle_domain}. + `$HOMEBREW_BOTTLE_DOMAIN` was set: #{Homebrew::EnvConfig.bottle_domain}. It has been unset for the migration. You may need to change this from a Linuxbrew package mirror to a Homebrew one. @@ -412,9 +412,9 @@ module Homebrew !Homebrew::EnvConfig.automatically_set_no_install_from_api? return unless no_install_from_api_set - ohai "You have HOMEBREW_NO_INSTALL_FROM_API set" + ohai "You have `$HOMEBREW_NO_INSTALL_FROM_API` set" puts "Homebrew >=4.1.0 is dramatically faster and less error-prone when installing" - puts "from the JSON API. Please consider unsetting HOMEBREW_NO_INSTALL_FROM_API." + puts "from the JSON API. Please consider unsetting `$HOMEBREW_NO_INSTALL_FROM_API`." puts "This message will only be printed once." puts "\n\n" diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index 6d1c314c83..98e91c7af3 100644 --- a/Library/Homebrew/cmd/update-reset.sh +++ b/Library/Homebrew/cmd/update-reset.sh @@ -52,6 +52,8 @@ homebrew-update-reset() { if [[ -z "${REPOS[*]}" ]] then + # HOMEBREW_REPOSITORY is set by bin/brew + # shellcheck disable=SC2154 REPOS+=("${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*) fi @@ -71,7 +73,7 @@ homebrew-update-reset() { echo ohai "Resetting ${DIR}..." - # HOMEBREW_* variables here may all set by bin/brew or the user + # HOMEBREW_* variables here may all be set by bin/brew or the user # shellcheck disable=SC2154 if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && (-n "${HOMEBREW_UPDATE_TO_TAG}" || diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index f8e1818e22..483df50370 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -650,9 +650,9 @@ EOS if [[ -z "${HOMEBREW_NO_ENV_HINTS}" && -z "${HOMEBREW_AUTO_UPDATE_SECS}" ]] then # shellcheck disable=SC2016 - echo 'Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with' >&2 + echo 'Adjust how often this is run with `$HOMEBREW_AUTO_UPDATE_SECS` or disable with' >&2 # shellcheck disable=SC2016 - echo 'HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).' >&2 + echo '`$HOMEBREW_NO_AUTO_UPDATE=1`. Hide these hints with `$HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).' >&2 fi else ohai 'Updating Homebrew...' >&2 diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 818cb91113..6bdfe78d0b 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -123,7 +123,7 @@ module Homebrew eval_all = args.eval_all? if !args.installed? && !eval_all - raise UsageError, "`brew uses` needs `--installed` or `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!" + raise UsageError, "`brew uses` needs `--installed` or `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!" end if show_formulae_and_casks || args.formula? diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index bde583810d..6d08ddba42 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -143,7 +143,7 @@ module Homebrew unless eval_all # This odisabled should probably stick around indefinitely. odisabled "brew audit", - "brew audit --eval-all or HOMEBREW_EVAL_ALL" + "`brew audit --eval-all` or set `HOMEBREW_EVAL_ALL=1`" end no_named_args = true [ diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index 68e87f9a49..2e07a9094a 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -117,7 +117,7 @@ module Homebrew else raise UsageError, "`brew bump` without named arguments needs `--installed` or `--eval-all` passed or " \ - "`$HOMEBREW_EVAL_ALL` set!" + "`HOMEBREW_EVAL_ALL=1` set!" end if args.start_with diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 52757b3f8d..40009d5fcd 100644 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -22,7 +22,7 @@ module Homebrew env: :eval_all switch "--dependents", description: "Determine runners for testing dependents. " \ - "Requires `--eval-all` or `$HOMEBREW_EVAL_ALL` to be set.", + "Requires `--eval-all` or `HOMEBREW_EVAL_ALL=1` to be set.", depends_on: "--eval-all" named_args max: 2 diff --git a/Library/Homebrew/dev-cmd/formula-analytics.rb b/Library/Homebrew/dev-cmd/formula-analytics.rb index 00d1bb120e..66a87bbdd2 100755 --- a/Library/Homebrew/dev-cmd/formula-analytics.rb +++ b/Library/Homebrew/dev-cmd/formula-analytics.rb @@ -109,10 +109,10 @@ module Homebrew return if args.setup? - odie "HOMEBREW_NO_ANALYTICS is set!" if ENV["HOMEBREW_NO_ANALYTICS"] + odie "`$HOMEBREW_NO_ANALYTICS` is set!" if ENV["HOMEBREW_NO_ANALYTICS"] token = ENV.fetch("HOMEBREW_INFLUXDB_TOKEN", nil) - odie "No InfluxDB credentials found in HOMEBREW_INFLUXDB_TOKEN!" unless token + odie "No InfluxDB credentials found in `$HOMEBREW_INFLUXDB_TOKEN`!" unless token client = InfluxDBClient3.new( token:, @@ -203,7 +203,7 @@ module Homebrew client.query(query:, language: "sql").to_batches rescue PyCall::PyError => e if e.message.include?("message: unauthenticated") - odie "Could not authenticate with InfluxDB! Please check your HOMEBREW_INFLUXDB_TOKEN!" + odie "Could not authenticate with InfluxDB! Please check your `$HOMEBREW_INFLUXDB_TOKEN`!" end raise end diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 116fc736c4..0feaa50794 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -481,7 +481,7 @@ module Homebrew name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}" if Homebrew::EnvConfig.disable_load_formula? - opoo "Can't check if updated bottles are necessary as HOMEBREW_DISABLE_LOAD_FORMULA is set!" + opoo "Can't check if updated bottles are necessary as `$HOMEBREW_DISABLE_LOAD_FORMULA` is set!" break end begin diff --git a/Library/Homebrew/dev-cmd/sh.rb b/Library/Homebrew/dev-cmd/sh.rb index df034059fe..176762bbfd 100644 --- a/Library/Homebrew/dev-cmd/sh.rb +++ b/Library/Homebrew/dev-cmd/sh.rb @@ -55,7 +55,7 @@ module Homebrew gem and pip will ignore our configuration and insist on using the environment they were built under (mostly). Sadly, scons will also ignore our configuration. - Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). + Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`). When done, type `exit`. EOS end diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 0eeff65f8f..c5287f42dc 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -68,7 +68,7 @@ module Homebrew eval_all = args.eval_all? if args.total? && !eval_all - raise UsageError, "`brew unbottled --total` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!" + raise UsageError, "`brew unbottled --total` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!" end if args.named.blank? @@ -116,7 +116,7 @@ module Homebrew formulae = all_formulae = args.named.to_formulae elsif args.dependents? unless eval_all - raise UsageError, "`brew unbottled --dependents` needs `--eval-all` passed or `$HOMEBREW_EVAL_ALL` set!" + raise UsageError, "`brew unbottled --dependents` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!" end formulae = all_formulae = Formula.all(eval_all:) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 323ddb553e..6d7aa6900b 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -475,7 +475,7 @@ module Homebrew which resolves to: #{HOMEBREW_CELLAR.realpath} The recommended Homebrew installations are either: - (A) Have Cellar be a real directory inside of your HOMEBREW_PREFIX + (A) Have Cellar be a real directory inside of your `$HOMEBREW_PREFIX` (B) Symlink "bin/brew" into your prefix, but don't symlink "Cellar". Older installations of Homebrew may have created a symlinked Cellar, but this can diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 2f8f6df89a..d24445136f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -609,7 +609,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy if Homebrew::EnvConfig.no_insecure_redirect? && url.start_with?("https://") && !resolved_url.start_with?("https://") - $stderr.puts "HTTPS to HTTP redirect detected and HOMEBREW_NO_INSECURE_REDIRECT is set." + $stderr.puts "HTTPS to HTTP redirect detected and `$HOMEBREW_NO_INSECURE_REDIRECT` is set." raise CurlDownloadStrategyError, url end diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 3ca5ce90ff..72640d86a3 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -331,9 +331,9 @@ end class TapCoreRemoteMismatchError < TapRemoteMismatchError def message <<~EOS - Tap #{name} remote does not match HOMEBREW_CORE_GIT_REMOTE. + Tap #{name} remote does not match `$HOMEBREW_CORE_GIT_REMOTE`. #{expected_remote} != #{actual_remote} - Please set HOMEBREW_CORE_GIT_REMOTE="#{actual_remote}" and run `brew update` instead. + Please set `HOMEBREW_CORE_GIT_REMOTE="#{actual_remote}"` and run `brew update` instead. EOS end end diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index 4df3665f5f..2b3ce195d8 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -381,8 +381,8 @@ module Kernel unless silent opoo <<~EOS Using #{editor} because no editor was set in the environment. - This may change in the future, so we recommend setting EDITOR - or HOMEBREW_EDITOR to your preferred text editor. + This may change in the future, so we recommend setting `$EDITOR` + or `$HOMEBREW_EDITOR` to your preferred text editor. EOS end diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index d03421e498..b5798ef545 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -37,7 +37,7 @@ module OS message + <<~EOS If you don't have administrative privileges on this machine, - create a directory and set the HOMEBREW_TEMP environment variable, + create a directory and set the `$HOMEBREW_TEMP` environment variable, for example: install -d -m 1755 ~/tmp #{Utils::Shell.set_variable_in_profile("HOMEBREW_TEMP", "~/tmp")} @@ -53,7 +53,7 @@ module OS <<~EOS The directory #{HOMEBREW_TEMP} does not permit executing - programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP + programs. It is likely mounted as "noexec". Please set `$HOMEBREW_TEMP` in your #{Utils::Shell.profile} to a different directory, for example: export HOMEBREW_TEMP=~/tmp echo 'export HOMEBREW_TEMP=~/tmp' >> #{Utils::Shell.profile} @@ -148,7 +148,7 @@ module OS return unless Homebrew::EnvConfig.bottle_domain.include?("linuxbrew") <<~EOS - Your HOMEBREW_BOTTLE_DOMAIN still contains "linuxbrew". + Your `$HOMEBREW_BOTTLE_DOMAIN` still contains "linuxbrew". You must unset it (or adjust it to not contain linuxbrew e.g. by using homebrew instead). EOS diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 51e0ec951b..472a025210 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1973,7 +1973,7 @@ class Formula sig { params(source: Pathname, target: Pathname).returns(String) } def rpath(source: bin, target: lib) unless target.to_s.start_with?(HOMEBREW_PREFIX) - raise "rpath `target` should only be used for paths inside HOMEBREW_PREFIX!" + raise "rpath `target` should only be used for paths inside `$HOMEBREW_PREFIX`!" end "#{loader_path}/#{target.relative_path_from(source)}" @@ -2244,7 +2244,7 @@ class Formula sig { params(eval_all: T::Boolean).returns(T::Array[Formula]) } def self.all(eval_all: false) if !eval_all && !Homebrew::EnvConfig.eval_all? - raise ArgumentError, "Formula#all without `--eval-all` or HOMEBREW_EVAL_ALL" + raise ArgumentError, "Formula#all cannot be used without `--eval-all` or `HOMEBREW_EVAL_ALL=1`" end (core_names + tap_files).filter_map do |name_or_file| diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e0b4f2661c..472b979791 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -277,8 +277,8 @@ class FormulaInstaller prefix = Pathname(bottle.cellar.to_s).parent opoo <<~EOS Building #{formula.full_name} from source as the bottle needs: - - HOMEBREW_CELLAR: #{bottle.cellar} (yours is #{HOMEBREW_CELLAR}) - - HOMEBREW_PREFIX: #{prefix} (yours is #{HOMEBREW_PREFIX}) + - `HOMEBREW_CELLAR=#{bottle.cellar}` (yours is #{HOMEBREW_CELLAR}) + - `HOMEBREW_PREFIX=#{prefix}` (yours is #{HOMEBREW_PREFIX}) EOS end return false @@ -1503,7 +1503,7 @@ on_request: installed_on_request?, options:) This typically indicates an invalid GitHub API token. - If you have `HOMEBREW_GITHUB_API_TOKEN` set, check it is correct + If you have `$HOMEBREW_GITHUB_API_TOKEN` set, check it is correct or unset it and instead run: gh auth login @@ -1517,7 +1517,7 @@ on_request: installed_on_request?, options:) The bottle for #{formula.name} could not be verified. This typically indicates a missing GitHub API token, which you - can resolve either by setting `HOMEBREW_GITHUB_API_TOKEN` or + can resolve either by setting `$HOMEBREW_GITHUB_API_TOKEN` or by running: gh auth login @@ -1649,7 +1649,7 @@ on_request: installed_on_request?, options:) if invalid_licenses.present? opoo <<~EOS - HOMEBREW_FORBIDDEN_LICENSES contains invalid license identifiers: #{invalid_licenses.to_sentence} + `$HOMEBREW_FORBIDDEN_LICENSES` contains invalid license identifiers: #{invalid_licenses.to_sentence} These licenses will not be forbidden. See the valid SPDX license identifiers at: #{Formatter.url("https://spdx.org/licenses/")} And the licenses for a formula with: @@ -1671,7 +1671,7 @@ on_request: installed_on_request?, options:) raise CannotInstallFormulaError, <<~EOS The installation of #{formula.name} has a dependency on #{dep.name} where all - its licenses were forbidden by #{owner} in `HOMEBREW_FORBIDDEN_LICENSES`: + its licenses were forbidden by #{owner} in `$HOMEBREW_FORBIDDEN_LICENSES`: #{SPDX.license_expression_to_string dep_f.license}#{owner_contact} EOS end @@ -1682,7 +1682,7 @@ on_request: installed_on_request?, options:) return unless SPDX.licenses_forbid_installation? formula.license, forbidden_licenses raise CannotInstallFormulaError, <<~EOS - #{formula.name}'s licenses are all forbidden by #{owner} in `HOMEBREW_FORBIDDEN_LICENSES`: + #{formula.name}'s licenses are all forbidden by #{owner} in `$HOMEBREW_FORBIDDEN_LICENSES`: #{SPDX.license_expression_to_string formula.license}#{owner_contact} EOS end @@ -1703,9 +1703,9 @@ on_request: installed_on_request?, options:) error_message = "The installation of #{formula.name} has a dependency #{dep.name}\n" \ "from the #{dep_tap} tap but #{owner} " - error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env? + error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env? error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env? - error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env? + error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if dep_tap.forbidden_by_env? error_message << ".#{owner_contact}" raise CannotInstallFormulaError, error_message @@ -1719,9 +1719,9 @@ on_request: installed_on_request?, options:) error_message = "The installation of #{formula.full_name} has the tap #{formula_tap}\n" \ "but #{owner} " - error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless formula_tap.allowed_by_env? + error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless formula_tap.allowed_by_env? error_message << " and\n" if !formula_tap.allowed_by_env? && formula_tap.forbidden_by_env? - error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if formula_tap.forbidden_by_env? + error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if formula_tap.forbidden_by_env? error_message << ".#{owner_contact}" raise CannotInstallFormulaError, error_message @@ -1751,7 +1751,7 @@ on_request: installed_on_request?, options:) raise CannotInstallFormulaError, <<~EOS The installation of #{formula.name} has a dependency #{dep_name} - but the #{dep_name} formula was forbidden by #{owner} in `HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact} + but the #{dep_name} formula was forbidden by #{owner} in `$HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact} EOS end end @@ -1768,7 +1768,7 @@ on_request: installed_on_request?, options:) raise CannotInstallFormulaError, <<~EOS The installation of #{formula_name} was forbidden by #{owner} - in `HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact} + in `$HOMEBREW_FORBIDDEN_FORMULAE`.#{owner_contact} EOS end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index db541b9050..efb2bf65b3 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -97,7 +97,7 @@ module Formulary using PathnameWriteMkpath def self.load_formula(name, path, contents, namespace, flags:, ignore_errors:) - raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula? + raise "Formula loading disabled by `$HOMEBREW_DISABLE_LOAD_FORMULA`!" if Homebrew::EnvConfig.disable_load_formula? require "formula" require "ignorable" diff --git a/Library/Homebrew/rubocops/text.rb b/Library/Homebrew/rubocops/text.rb index 3323aeb176..cc29a70ac6 100644 --- a/Library/Homebrew/rubocops/text.rb +++ b/Library/Homebrew/rubocops/text.rb @@ -38,7 +38,7 @@ module RuboCop end if find_node_method_by_name(body_node, :keg_only)&.source&.include?("HOMEBREW_PREFIX") - problem "`keg_only` reason should not include `HOMEBREW_PREFIX` " \ + problem "`keg_only` reason should not include `$HOMEBREW_PREFIX` " \ "as it creates confusing `brew info` output." end end diff --git a/Library/Homebrew/services/system.rb b/Library/Homebrew/services/system.rb index b821ca60d2..ef8eda32d0 100644 --- a/Library/Homebrew/services/system.rb +++ b/Library/Homebrew/services/system.rb @@ -90,8 +90,8 @@ module Homebrew opoo "uid and euid do not match, using user/* instead of gui/* domain!" end unless Homebrew::EnvConfig.no_env_hints? - puts "Hide this warning by setting HOMEBREW_SERVICES_NO_DOMAIN_WARNING." - puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)." + puts "Hide this warning by setting `HOMEBREW_SERVICES_NO_DOMAIN_WARNING=1`." + puts "Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`)." end @output_warning = T.let(true, T.nilable(TrueClass)) end diff --git a/Library/Homebrew/startup/bootsnap.rb b/Library/Homebrew/startup/bootsnap.rb index 1401ee4d21..02ef0d4322 100644 --- a/Library/Homebrew/startup/bootsnap.rb +++ b/Library/Homebrew/startup/bootsnap.rb @@ -18,7 +18,7 @@ module Homebrew private_class_method def self.cache_dir cache = ENV.fetch("HOMEBREW_CACHE", nil) || ENV.fetch("HOMEBREW_DEFAULT_CACHE", nil) - raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? + raise "Needs `$HOMEBREW_CACHE` or `$HOMEBREW_DEFAULT_CACHE`!" if cache.nil? || cache.empty? File.join(cache, "bootsnap", key) end diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index 7fdb06adcb..d8016a024a 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -201,7 +201,9 @@ class SystemCommand askpass_flags = ENV.key?("SUDO_ASKPASS") ? ["-A"] : [] user_flags = [] if Homebrew::EnvConfig.sudo_through_sudo_user? - raise ArgumentError, "HOMEBREW_SUDO_THROUGH_SUDO_USER set but SUDO_USER unset!" if homebrew_sudo_user.blank? + if homebrew_sudo_user.blank? + raise ArgumentError, "`$HOMEBREW_SUDO_THROUGH_SUDO_USER` set but `$SUDO_USER` unset!" + end user_flags += ["--prompt", "Password for %p:", "-u", homebrew_sudo_user, *askpass_flags, diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index e6c01674ee..9eb4708444 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -120,7 +120,7 @@ class Tap Set.new(allowed_tap_list.filter_map do |tap| Tap.fetch(tap) rescue Tap::InvalidNameError - opoo "Invalid tap name in `HOMEBREW_ALLOWED_TAPS`: #{tap}" + opoo "Invalid tap name in `$HOMEBREW_ALLOWED_TAPS`: #{tap}" nil end).freeze end @@ -135,7 +135,7 @@ class Tap Set.new(forbidden_tap_list.filter_map do |tap| Tap.fetch(tap) rescue Tap::InvalidNameError - opoo "Invalid tap name in `HOMEBREW_FORBIDDEN_TAPS`: #{tap}" + opoo "Invalid tap name in `$HOMEBREW_FORBIDDEN_TAPS`: #{tap}" nil end).freeze end @@ -432,9 +432,9 @@ class Tap end error_message = "The installation of the #{full_name} was requested but #{owner}\n" - error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless allowed_by_env? + error_message << "has not allowed this tap in `$HOMEBREW_ALLOWED_TAPS`" unless allowed_by_env? error_message << " and\n" if !allowed_by_env? && forbidden_by_env? - error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if forbidden_by_env? + error_message << "has forbidden this tap in `$HOMEBREW_FORBIDDEN_TAPS`" if forbidden_by_env? error_message << ".#{owner_contact}" odie error_message diff --git a/Library/Homebrew/test/cmd/desc_spec.rb b/Library/Homebrew/test/cmd/desc_spec.rb index 4c699e62f5..df296ce6f4 100644 --- a/Library/Homebrew/test/cmd/desc_spec.rb +++ b/Library/Homebrew/test/cmd/desc_spec.rb @@ -19,7 +19,7 @@ RSpec.describe Homebrew::Cmd::Desc do setup_test_formula "testball" expect { brew "desc", "--search", "testball" } - .to output(/`brew desc --search` needs `--eval-all` passed or `\$HOMEBREW_EVAL_ALL` set!/).to_stderr + .to output(/`brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL=1` set!/).to_stderr .and be_a_failure end diff --git a/Library/Homebrew/test/test_runner_formula_spec.rb b/Library/Homebrew/test/test_runner_formula_spec.rb index 2f46c3598a..3f0064a3bf 100644 --- a/Library/Homebrew/test/test_runner_formula_spec.rb +++ b/Library/Homebrew/test/test_runner_formula_spec.rb @@ -33,7 +33,7 @@ RSpec.describe TestRunnerFormula do expect(described_class.new(testball, eval_all: true).eval_all).to be(true) end - it "takes the value of `HOMEBREW_EVAL_ALL` at instantiation time if not specified" do + it "takes the value of HOMEBREW_EVAL_ALL at instantiation time if not specified" do allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) expect(described_class.new(testball).eval_all).to be(true) diff --git a/Library/Homebrew/test/utils/curl_spec.rb b/Library/Homebrew/test/utils/curl_spec.rb index 6be97daba9..8296e1d0c3 100644 --- a/Library/Homebrew/test/utils/curl_spec.rb +++ b/Library/Homebrew/test/utils/curl_spec.rb @@ -323,7 +323,7 @@ RSpec.describe "Utils::Curl" do end describe "::curl_executable" do - it "returns `HOMEBREW_BREWED_CURL_PATH` when `use_homebrew_curl` is `true`" do + it "returns HOMEBREW_BREWED_CURL_PATH when `use_homebrew_curl` is `true`" do expect(curl_executable(use_homebrew_curl: true)).to eq(HOMEBREW_BREWED_CURL_PATH) end diff --git a/Library/Homebrew/upgrade.rb b/Library/Homebrew/upgrade.rb index 2f4855709f..5ec9e528d5 100644 --- a/Library/Homebrew/upgrade.rb +++ b/Library/Homebrew/upgrade.rb @@ -170,7 +170,7 @@ module Homebrew if Homebrew::EnvConfig.no_installed_dependents_check? unless Homebrew::EnvConfig.no_env_hints? opoo <<~EOS - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set: not checking for outdated + `$HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK` is set: not checking for outdated dependents or dependents with broken linkage! EOS end @@ -418,8 +418,8 @@ module Homebrew return if Homebrew::EnvConfig.no_installed_dependents_check? return if @puts_no_installed_dependents_check_disable_message_if_not_already - puts "Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK." - puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)." + puts "Disable this behaviour by setting `HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1`." + puts "Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`)." @puts_no_installed_dependents_check_disable_message_if_not_already = T.let(true, T.nilable(T::Boolean)) end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index a2928de8a7..430d1cd14e 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -899,7 +899,7 @@ module GitHub end def self.count_repo_commits(nwo, user, from: nil, to: nil, max: nil) - odie "Cannot count commits, HOMEBREW_NO_GITHUB_API set!" if Homebrew::EnvConfig.no_github_api? + odie "Cannot count commits as `$HOMEBREW_NO_GITHUB_API` is set!" if Homebrew::EnvConfig.no_github_api? author_shas = repo_commits_for_user(nwo, user, "author", from, to, max) committer_shas = repo_commits_for_user(nwo, user, "committer", from, to, max) @@ -922,7 +922,7 @@ module GitHub # BrewTestBot can open as many PRs as it wants. return false if ENV["HOMEBREW_TEST_BOT_AUTOBUMP"].present? - odie "Cannot count PRs, HOMEBREW_NO_GITHUB_API set!" if Homebrew::EnvConfig.no_github_api? + odie "Cannot count PRs as `$HOMEBREW_NO_GITHUB_API` is set!" if Homebrew::EnvConfig.no_github_api? query = <<~EOS query($after: String) { diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index dba7173124..40170cf12e 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -113,7 +113,7 @@ module GitHub when :env_token require "utils/formatter" <<~EOS - HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check: + `$HOMEBREW_GITHUB_API_TOKEN` may be invalid or expired; check: #{Formatter.url("https://github.com/settings/tokens")} EOS when :none diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 30ebb959c3..931a364eaf 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -693,7 +693,7 @@ __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l formula -l formu __fish_brew_complete_cmd 'determine-test-runners' 'Determines the runners used to test formulae or their dependents' __fish_brew_complete_arg 'determine-test-runners' -l all-supported -d 'Instead of selecting runners based on the chosen formula, return all supported runners' __fish_brew_complete_arg 'determine-test-runners' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. Requires `--eval-all` or `$HOMEBREW_EVAL_ALL` to be set' +__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL=1` to be set' __fish_brew_complete_arg 'determine-test-runners' -l eval-all -d 'Evaluate all available formulae, whether installed or not, to determine testing dependents. Enabled by default if `$HOMEBREW_EVAL_ALL` is set' __fish_brew_complete_arg 'determine-test-runners' -l help -d 'Show this message' __fish_brew_complete_arg 'determine-test-runners' -l quiet -d 'Make some output more quiet' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index a285c4809c..20ef1bc1eb 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -875,7 +875,7 @@ _brew_determine_test_runners() { _arguments \ '(--dependents)--all-supported[Instead of selecting runners based on the chosen formula, return all supported runners]' \ '--debug[Display any debugging information]' \ - '(--all-supported)--dependents[Determine runners for testing dependents. Requires `--eval-all` or `$HOMEBREW_EVAL_ALL` to be set]' \ + '(--all-supported)--dependents[Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL=1` to be set]' \ '--eval-all[Evaluate all available formulae, whether installed or not, to determine testing dependents. Enabled by default if `$HOMEBREW_EVAL_ALL` is set]' \ '--help[Show this message]' \ '--quiet[Make some output more quiet]' \