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 <dominyktiller@gmail.com>
This commit is contained in:
Dominyk Tiller 2016-01-09 16:32:23 +00:00
parent 08fb36252c
commit f4f2266923

View File

@ -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