From baecc4fdee6d58543011b695bdab0a127980331c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 2 Apr 2019 14:38:59 +0100 Subject: [PATCH] diagnostic: report unreadable, installed formulae. We previously did this somewhat unintentionally. `brew readall` does this for all formulae but takes way longer. --- Library/Homebrew/diagnostic.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 8a14daa4ce..ee279ee228 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -713,6 +713,25 @@ module Homebrew EOS end + def check_for_unreadable_installed_formula + formula_unavailable_exceptions = [] + Formula.racks.each do |rack| + begin + Formulary.from_rack(rack) + rescue FormulaUnavailableError => e + formula_unavailable_exceptions << e + rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError + nil + end + end + return if formula_unavailable_exceptions.empty? + + <<~EOS + Some installed formulae are not readable: + #{formula_unavailable_exceptions.join("\n\n ")} + EOS + end + def check_for_unlinked_but_not_keg_only unlinked = Formula.racks.reject do |rack| if !(HOMEBREW_LINKED_KEGS/rack.basename).directory?