From f4f2266923b9530ddbefbf55b8764d73b617cadd Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Sat, 9 Jan 2016 16:32:23 +0000 Subject: [PATCH] audit: check for more unused shorthand Adding a strict check for usage that should be using pkgshare. Pulled onto two unique checks to provide a better problem message, with a clearer solution, but open to thoughts. * Use pkgshare instead of (share/"example") * Use #{pkgshare} instead of #{share}/example Closes Homebrew/homebrew#47900. Signed-off-by: Dominyk Tiller --- Library/Homebrew/cmd/audit.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 3750eaf25c..99614a3fd0 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -855,6 +855,14 @@ class FormulaAuditor if line =~ /(require ["']formula["'])/ problem "`#{$1}` is now unnecessary" end + + if line =~ /#\{share\}\/#{formula.name}/ + problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}" + end + + if line =~ /share\/"#{formula.name}"/ + problem "Use pkgshare instead of (share/\"#{formula.name}\")" + end end end