Skip to content

Commit

Permalink
Merge pull request #16879 from cho-m/diagnostic-taploader
Browse files Browse the repository at this point in the history
diagnostic: use FromTapLoader to check 3rd-party formula
  • Loading branch information
cho-m authored Mar 14, 2024
2 parents 0927f47 + 495bdd0 commit 697d416
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -835,25 +835,20 @@ def check_deleted_formula

deleted_formulae = kegs.filter_map do |keg|
tap = Tab.for_keg(keg).tap
tap_keg_name = tap ? "#{tap}/#{keg.name}" : keg.name

loadable = [
Formulary::FromAPILoader,
Formulary::FromTapLoader,
Formulary::FromNameLoader,
].any? do |loader_class|
loader = begin
loader_class.try_new(keg.name, warn: false)
loader_class.try_new(tap_keg_name, warn: false)
rescue TapFormulaAmbiguityError => e
e.loaders.first
end

if loader
# If we know the tap, ignore all other taps.
next false if tap && loader.tap != tap

next true
end

false
loader.instance_of?(Formulary::FromTapLoader) ? loader.path.exist? : loader.present?
end

keg.name unless loadable
Expand Down

0 comments on commit 697d416

Please sign in to comment.