Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add brew doctor --ignore-warnings #17864

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Library/Homebrew/cmd/doctor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class Doctor < AbstractCommand
switch "-D", "--audit-debug",
description: "Enable debugging and profiling of audit methods."

switch "--ignore-warnings",
description: "Only exit with a non-zero status if errors are " \
"encountered. Warnings are still displayed but will " \
"not cause the command to fail."

named_args :diagnostic_check
end

Expand All @@ -48,7 +53,7 @@ def run
methods = args.named
end

first_warning = T.let(true, T::Boolean)
seen_warning = T.let(false, T::Boolean)
methods.each do |method|
$stderr.puts Formatter.headline("Checking #{method}", color: :magenta) if args.debug?
unless checks.respond_to?(method)
Expand All @@ -59,7 +64,7 @@ def run
out = checks.send(method)
next if out.blank?

if first_warning
unless seen_warning
$stderr.puts <<~EOS
#{Tty.bold}Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
Expand All @@ -69,11 +74,11 @@ def run

$stderr.puts
opoo out
Homebrew.failed = true
first_warning = false
Homebrew.failed = true unless args.ignore_warnings?
seen_warning = true
end

puts "Your system is ready to brew." if !Homebrew.failed? && !args.quiet?
puts "Your system is ready to brew." if !Homebrew.failed? && !seen_warning && !args.quiet?
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/doctor.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading