messages/comments: formatting fixes

This commit is contained in:
Eric Knibbe 2025-08-15 22:42:54 -04:00
parent d5abe49172
commit e021953db4
No known key found for this signature in database
18 changed files with 43 additions and 37 deletions

View File

@ -201,7 +201,7 @@ then
odie <<EOS odie <<EOS
conflicting Homebrew wrapper configuration! conflicting Homebrew wrapper configuration!
HOMEBREW_FORCE_BREW_WRAPPER was set to ${HOMEBREW_FORCE_BREW_WRAPPER} HOMEBREW_FORCE_BREW_WRAPPER was set to ${HOMEBREW_FORCE_BREW_WRAPPER}
but HOMEBREW_BREW_WRAPPER was unset. but HOMEBREW_BREW_WRAPPER was unset.
$(bold "Ensure you run ${HOMEBREW_FORCE_BREW_WRAPPER} directly (not ${HOMEBREW_BREW_FILE})")! $(bold "Ensure you run ${HOMEBREW_FORCE_BREW_WRAPPER} directly (not ${HOMEBREW_BREW_FILE})")!
@ -713,8 +713,8 @@ else
then then
message="Please update your system curl or set HOMEBREW_CURL_PATH to a newer version. message="Please update your system curl or set HOMEBREW_CURL_PATH to a newer version.
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION} Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
Your curl version: ${curl_name_and_version##* } Your curl version: ${curl_name_and_version##* }
Your curl executable: $(type -p "${HOMEBREW_CURL}")" Your curl executable: $(type -p "${HOMEBREW_CURL}")"
if [[ -z ${HOMEBREW_CURL_PATH} ]] if [[ -z ${HOMEBREW_CURL_PATH} ]]
then then
@ -741,8 +741,8 @@ Your curl executable: $(type -p "${HOMEBREW_CURL}")"
then then
message="Please update your system Git or set HOMEBREW_GIT_PATH to a newer version. message="Please update your system Git or set HOMEBREW_GIT_PATH to a newer version.
Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION} Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION}
Your Git version: ${major}.${minor}.${micro}.${build} Your Git version: ${major}.${minor}.${micro}.${build}
Your Git executable: $(unset git && type -p "${HOMEBREW_GIT}")" Your Git executable: $(unset git && type -p "${HOMEBREW_GIT}")"
if [[ -z ${HOMEBREW_GIT_PATH} ]] if [[ -z ${HOMEBREW_GIT_PATH} ]]
then then
HOMEBREW_FORCE_BREWED_GIT="1" HOMEBREW_FORCE_BREWED_GIT="1"

View File

@ -537,8 +537,8 @@ module Cask
# Shell scripts cannot be signed, so we skip them # Shell scripts cannot be signed, so we skip them
next false if path.text_executable? next false if path.text_executable?
system_command("codesign", args: ["--verify", "-R=notarized", "--check-notarization", path], system_command("codesign", args: ["--verify", "-R=notarized", "--check-notarization", path],
print_stderr: false) print_stderr: false)
else else
add_error "Unknown artifact type: #{artifact.class}", location: url.location add_error "Unknown artifact type: #{artifact.class}", location: url.location
end end

View File

@ -181,7 +181,7 @@ module Homebrew
# `build.rb`. Instead, `hide_from_man_page` and don't do anything with # `build.rb`. Instead, `hide_from_man_page` and don't do anything with
# this argument here. # this argument here.
# This odisabled should stick around indefinitely. # This odisabled should stick around indefinitely.
odisabled "brew install --env", "`env :std` in specific formula files" odisabled "`brew install --env`", "`env :std` in specific formula files"
end end
args.named.each do |name| args.named.each do |name|

View File

@ -112,7 +112,7 @@ module Homebrew
] ]
if no_named_formula_commands.include?(subcommand) if no_named_formula_commands.include?(subcommand)
raise UsageError, "The `#{subcommand}` subcommand does not accept a formula argument!" if formulae.present? raise UsageError, "The `#{subcommand}` subcommand does not accept a formula argument!" if formulae.present?
raise UsageError, "The `#{subcommand}` subcommand does not accept the --all argument!" if args.all? raise UsageError, "The `#{subcommand}` subcommand does not accept the `--all` argument!" if args.all?
end end
if args.file if args.file
@ -122,22 +122,25 @@ module Homebrew
*Homebrew::Services::Commands::Restart::TRIGGERS, *Homebrew::Services::Commands::Restart::TRIGGERS,
] ]
if file_commands.exclude?(subcommand) if file_commands.exclude?(subcommand)
raise UsageError, "The `#{subcommand}` subcommand does not accept the --file= argument!" raise UsageError, "The `#{subcommand}` subcommand does not accept the `--file=` argument!"
elsif args.all? elsif args.all?
raise UsageError, raise UsageError,
"The `#{subcommand}` subcommand does not accept the --all and --file= arguments at the same time!" "The `#{subcommand}` subcommand does not accept the `--all` and `--file=` arguments at the same time!"
end end
end end
unless Homebrew::Services::Commands::Stop::TRIGGERS.include?(subcommand) unless Homebrew::Services::Commands::Stop::TRIGGERS.include?(subcommand)
raise UsageError, "The `#{subcommand}` subcommand does not accept the --keep argument!" if args.keep? raise UsageError, "The `#{subcommand}` subcommand does not accept the `--keep` argument!" if args.keep?
raise UsageError, "The `#{subcommand}` subcommand does not accept the --no-wait argument!" if args.no_wait?
if args.no_wait?
raise UsageError, "The `#{subcommand}` subcommand does not accept the `--no-wait` argument!"
end
if args.max_wait if args.max_wait
raise UsageError, "The `#{subcommand}` subcommand does not accept the --max-wait= argument!" raise UsageError, "The `#{subcommand}` subcommand does not accept the `--max-wait=` argument!"
end end
end end
opoo "The --all argument overrides provided formula argument!" if formulae.present? && args.all? opoo "The `--all` argument overrides provided formula argument!" if formulae.present? && args.all?
targets = if args.all? targets = if args.all?
if subcommand == "start" if subcommand == "start"

View File

@ -126,7 +126,7 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
if args.build_from_source? && args.named.empty? if args.build_from_source? && args.named.empty?
raise ArgumentError, "--build-from-source requires at least one formula" raise ArgumentError, "`--build-from-source` requires at least one formula"
end end
formulae, casks = args.named.to_resolved_formulae_to_casks formulae, casks = args.named.to_resolved_formulae_to_casks

View File

@ -104,7 +104,7 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
odeprecated "brew audit --token-conflicts" if args.token_conflicts? odeprecated "`brew audit --token-conflicts`" if args.token_conflicts?
Formulary.enable_factory_cache! Formulary.enable_factory_cache!
@ -142,7 +142,7 @@ module Homebrew
unless eval_all unless eval_all
# This odisabled should probably stick around indefinitely. # This odisabled should probably stick around indefinitely.
odisabled "brew audit", odisabled "`brew audit`",
"`brew audit --eval-all` or set `HOMEBREW_EVAL_ALL=1`" "`brew audit --eval-all` or set `HOMEBREW_EVAL_ALL=1`"
end end
no_named_args = true no_named_args = true
@ -154,8 +154,8 @@ module Homebrew
if args.named.any? { |named_arg| named_arg.end_with?(".rb") } if args.named.any? { |named_arg| named_arg.end_with?(".rb") }
# This odisabled should probably stick around indefinitely, # This odisabled should probably stick around indefinitely,
# until at least we have a way to exclude error on these in the CLI parser. # until at least we have a way to exclude error on these in the CLI parser.
odisabled "brew audit [path ...]", odisabled "`brew audit [path ...]`",
"brew audit [name ...]" "`brew audit [name ...]`"
end end
args.named.to_formulae_and_casks_with_taps args.named.to_formulae_and_casks_with_taps

View File

@ -57,15 +57,15 @@ module Homebrew
syntax_only = args.syntax_only? syntax_only = args.syntax_only?
repository = ENV.fetch("GITHUB_REPOSITORY", nil) repository = ENV.fetch("GITHUB_REPOSITORY", nil)
raise UsageError, "The GITHUB_REPOSITORY environment variable must be set." if repository.blank? raise UsageError, "The `$GITHUB_REPOSITORY` environment variable must be set." if repository.blank?
tap = T.let(Tap.fetch(repository), Tap) tap = T.let(Tap.fetch(repository), Tap)
unless syntax_only unless syntax_only
raise UsageError, "Either `--cask` or `--url` must be specified." if !args.casks? && !args.url? raise UsageError, "Either `--cask` or `--url` must be specified." if !args.casks? && !args.url?
raise UsageError, "Please provide a cask or url argument" if casks.blank? && pr_url.blank? raise UsageError, "Please provide a `--cask` or `--url` argument." if casks.blank? && pr_url.blank?
end end
raise UsageError, "Only one url can be specified" if pr_url&.count&.> 1 raise UsageError, "Only one `--url` can be specified." if pr_url&.count&.> 1
labels = if pr_url && (first_pr_url = pr_url.first) labels = if pr_url && (first_pr_url = pr_url.first)
pr = GitHub::API.open_rest(first_pr_url) pr = GitHub::API.open_rest(first_pr_url)

View File

@ -267,7 +267,7 @@ module SharedEnvExtension
ohai "Using a Fortran compiler found at #{gfortran}" ohai "Using a Fortran compiler found at #{gfortran}"
end end
if gfortran if gfortran
puts "This may be changed by setting the FC environment variable." puts "This may be changed by setting the `$FC` environment variable."
self["FC"] = self["F77"] = gfortran self["FC"] = self["F77"] = gfortran
flags = FC_FLAG_VARS flags = FC_FLAG_VARS
end end

View File

@ -417,7 +417,7 @@ module OS
macOS won't move relative symlinks across volumes unless the target file already macOS won't move relative symlinks across volumes unless the target file already
exists. Formulae known to be affected by this are Git and Narwhal. exists. Formulae known to be affected by this are Git and Narwhal.
You should set the "HOMEBREW_TEMP" environment variable to a suitable You should set the `$HOMEBREW_TEMP` environment variable to a suitable
directory on the same volume as your Cellar. directory on the same volume as your Cellar.
#{support_tier_message(tier: 2)} #{support_tier_message(tier: 2)}

View File

@ -382,7 +382,7 @@ class FormulaInstaller
check_installation_already_attempted check_installation_already_attempted
if force_bottle? && !pour_bottle? if force_bottle? && !pour_bottle?
raise CannotInstallFormulaError, "--force-bottle passed but #{formula.full_name} has no bottle!" raise CannotInstallFormulaError, "`--force-bottle` passed but #{formula.full_name} has no bottle!"
end end
if Homebrew.default_prefix? && if Homebrew.default_prefix? &&

View File

@ -49,12 +49,12 @@ module Homebrew
elsif owner.is_a?(Formula) && !version.to_s.match?(GitHubPackages::VALID_OCI_TAG_REGEX) && elsif owner.is_a?(Formula) && !version.to_s.match?(GitHubPackages::VALID_OCI_TAG_REGEX) &&
(owner.core_formula? || (owner.core_formula? ||
(owner.bottle_defined? && GitHubPackages::URL_REGEX.match?(owner.bottle_specification.root_url))) (owner.bottle_defined? && GitHubPackages::URL_REGEX.match?(owner.bottle_specification.root_url)))
problem "version #{version} does not match #{GitHubPackages::VALID_OCI_TAG_REGEX.source}" problem "`version #{version}` does not match #{GitHubPackages::VALID_OCI_TAG_REGEX.source}"
elsif !version.detected_from_url? elsif !version.detected_from_url?
version_text = version version_text = version
version_url = Version.detect(url, **specs) version_url = Version.detect(url, **specs)
if version_url.to_s == version_text.to_s && version.instance_of?(Version) if version_url.to_s == version_text.to_s && version.instance_of?(Version)
problem "version #{version_text} is redundant with version scanned from URL" problem "`version #{version_text}` is redundant with version scanned from URL"
end end
end end
end end

View File

@ -43,7 +43,7 @@ module Homebrew
# Check if formula has been found. # Check if formula has been found.
def self.check!(targets) def self.check!(targets)
raise UsageError, "Formula(e) missing, please provide a formula name or use --all" if targets.empty? raise UsageError, "Formula(e) missing, please provide a formula name or use `--all`." if targets.empty?
true true
end end

View File

@ -23,7 +23,7 @@ RSpec.describe BottleSpecification do
it "works with cellar" do it "works with cellar" do
checksums = [ checksums = [
{ cellar: :any_skip_relocation, tag: :arm64_big_sur, digest: "deadbeef" * 8 }, { cellar: :any_skip_relocation, tag: :arm64_big_sur, digest: "deadbeef" * 8 },
{ cellar: :any, tag: :big_sur, digest: "faceb00c" * 8 }, { cellar: :any, tag: :big_sur, digest: "faceb00c" * 8 },
{ cellar: "/usr/local/Cellar", tag: :catalina, digest: "baadf00d" * 8 }, { cellar: "/usr/local/Cellar", tag: :catalina, digest: "baadf00d" * 8 },
{ cellar: Homebrew::DEFAULT_CELLAR, tag: :mojave, digest: "8badf00d" * 8 }, { cellar: Homebrew::DEFAULT_CELLAR, tag: :mojave, digest: "8badf00d" * 8 },

View File

@ -46,14 +46,15 @@ RSpec.describe Homebrew::Services::Cli do
it "checks the input does not exist" do it "checks the input does not exist" do
expect do expect do
services_cli.check!([]) services_cli.check!([])
end.to raise_error(UsageError, "Invalid usage: Formula(e) missing, please provide a formula name or use --all") end.to raise_error(UsageError,
"Invalid usage: Formula(e) missing, please provide a formula name or use `--all`.")
end end
it "checks the input exists" do it "checks the input exists" do
expect do expect do
services_cli.check!("hello") services_cli.check!("hello")
end.not_to raise_error(UsageError, end.not_to raise_error(UsageError,
"Invalid usage: Formula(e) missing, please provide a formula name or use --all") "Invalid usage: Formula(e) missing, please provide a formula name or use `--all`.")
end end
end end
@ -178,7 +179,7 @@ RSpec.describe Homebrew::Services::Cli do
services_cli.install_service_file(service, nil) services_cli.install_service_file(service, nil)
end.to raise_error( end.to raise_error(
UsageError, UsageError,
"Invalid usage: Formula `name` has not implemented #plist, #service or installed a locatable service file", "Invalid usage: Formula `name` has not implemented #plist, #service or provided a locatable service file.",
) )
end end
end end

View File

@ -17,7 +17,8 @@ RSpec.describe Homebrew::Services::Commands::Info do
it "fails with empty list" do it "fails with empty list" do
expect do expect do
described_class.run([], verbose: false, json: false) described_class.run([], verbose: false, json: false)
end.to raise_error UsageError, "Invalid usage: Formula(e) missing, please provide a formula name or use --all" end.to raise_error UsageError,
"Invalid usage: Formula(e) missing, please provide a formula name or use `--all`."
end end
it "succeeds with items" do it "succeeds with items" do

View File

@ -13,7 +13,8 @@ RSpec.describe Homebrew::Services::Commands::Restart do
it "fails with empty list" do it "fails with empty list" do
expect do expect do
described_class.run([], nil, verbose: false) described_class.run([], nil, verbose: false)
end.to raise_error UsageError, "Invalid usage: Formula(e) missing, please provide a formula name or use --all" end.to raise_error UsageError,
"Invalid usage: Formula(e) missing, please provide a formula name or use `--all`."
end end
it "starts if services are not loaded" do it "starts if services are not loaded" do

View File

@ -104,7 +104,7 @@ RSpec.describe Version do
it "raises an error" do it "raises an error" do
expect do expect do
null_version.to_str null_version.to_str
end.to raise_error NoMethodError, "undefined method `to_str' for Version:NULL" end.to raise_error NoMethodError, "undefined method `to_str` for Version:NULL"
end end
end end

View File

@ -723,7 +723,7 @@ class Version
# @api public # @api public
sig { returns(String) } sig { returns(String) }
def to_str def to_str
raise NoMethodError, "undefined method `to_str' for #{self.class}:NULL" if null? raise NoMethodError, "undefined method `to_str` for #{self.class}:NULL" if null?
T.must(version).to_str T.must(version).to_str
end end