audit: check for use of FileUtils methods.
This commit is contained in:
parent
9bd8229ba2
commit
3e3a4cad50
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user