From 185b1787c61d6201f38e5fabad397cdaeb0a6762 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 22 Apr 2017 13:00:36 +0100 Subject: [PATCH] audit: lookup unversioned formulae with Formulary. This means that if e.g. the unversioned formulae exists in another tap this audit won't produce a false positive. --- Library/Homebrew/dev-cmd/audit.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 07d2e71cba..f3bfb4c0c0 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -336,7 +336,18 @@ class FormulaAuditor problem "File should end with a newline" unless text.trailing_newline? if formula.versioned_formula? - unversioned_formula = Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb") + unversioned_formula = begin + # build this ourselves as we want e.g. homebrew/core to be present + full_name = if formula.tap + "#{formula.tap}/#{formula.name}" + else + formula.name + end + Formulary.factory(full_name.gsub(/@.*$/, "")).path + rescue FormulaUnavailableError, TapFormulaAmbiguityError, + TapFormulaWithOldnameAmbiguityError + Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb") + end unless unversioned_formula.exist? unversioned_name = unversioned_formula.basename(".rb") problem "#{formula} is versioned but no #{unversioned_name} formula exists"