audit: check for use of FileUtils methods.

This commit is contained in:
Mike McQuaid 2014-12-27 14:00:51 +00:00
parent 9bd8229ba2
commit 3e3a4cad50

View File

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