aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2014-03-29 09:16:27 -0500
committerMike McQuaid2014-03-31 11:52:59 -0500
commitbf8ff2dcb72649ae87d4561ceef4e0a590bdea60 (patch)
tree94441dac5387e3d153296deac0d2b0bde3aa9d57 /Library/Homebrew/cmd
parent94f324d778e672539116e2a89273398e91eaa7d2 (diff)
downloadbrew-bf8ff2dcb72649ae87d4561ceef4e0a590bdea60.tar.bz2
audit: check the use of Dir[]
Sometimes `Dir[]` is used with single files/directories unnecessarily.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/audit.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index db56663a4..721f6c987 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -525,6 +525,10 @@ class FormulaAuditor
if line =~ /depends_on ['"](.+)['"] (if.+|unless.+)$/
audit_conditional_dep($1, $2, $&)
end
+
+ if line =~ /(Dir\[("[^\*{},]+")\])/
+ problem "#{$1} is unnecessary; just use #{$2}"
+ end
end
def audit_conditional_dep(dep, condition, line)