aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2014-12-27 14:00:51 +0000
committerMike McQuaid2014-12-27 16:31:43 +0000
commit0765d70400a5e33de00bb6cf08f9a26fd11e68f5 (patch)
tree557f6f3138e619d6d75663fa4defc144bb27d6a3 /Library
parentd87ba53333b976b4595e71039b4911601f690d55 (diff)
downloadhomebrew-0765d70400a5e33de00bb6cf08f9a26fd11e68f5.tar.bz2
audit: check for use of FileUtils methods.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index f8db07c94..7d70ad053 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -78,6 +78,8 @@ class FormulaAuditor
swig
]
+ FILEUTILS_METHODS = FileUtils.singleton_methods(false).join "|"
+
def initialize(formula, options={})
@formula = formula
@strict = !!options[:strict]
@@ -534,6 +536,12 @@ class FormulaAuditor
if line =~ /(Dir\[("[^\*{},]+")\])/
problem "#{$1} is unnecessary; just use #{$2}"
end
+
+ if line =~ /system (["'](#{FILEUTILS_METHODS}))["' ]/
+ system = $1
+ method = $2
+ problem "Use the `#{method}` Ruby method instead of `system #{system}`"
+ end
end
def audit_conditional_dep(dep, condition, line)