Skip to content

Commit

Permalink
diagnostic: use FromTapLoader to check 3rd-party formula
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Cho <michael@michaelcho.dev>
  • Loading branch information
cho-m committed Mar 12, 2024
1 parent 2d77465 commit 15dd331
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
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(keg_name, warn: false)

Check warning on line 846 in Library/Homebrew/diagnostic.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/diagnostic.rb#L846

Added line #L846 was not covered by tests
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 15dd331

Please sign in to comment.