Merge pull request #1402 from MikeMcQuaid/audit-system-test
audit: check test system calls are fully scoped.
This commit is contained in:
commit
8d5df2ea87
@ -721,6 +721,19 @@ class FormulaAuditor
|
|||||||
problem %q(use "xcodebuild *args" instead of "system 'xcodebuild', *args")
|
problem %q(use "xcodebuild *args" instead of "system 'xcodebuild', *args")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bin_names = Set.new
|
||||||
|
bin_names << formula.name
|
||||||
|
bin_names += formula.aliases
|
||||||
|
[formula.bin, formula.sbin].each do |dir|
|
||||||
|
next unless dir.exist?
|
||||||
|
bin_names += dir.children.map(&:basename).map(&:to_s)
|
||||||
|
end
|
||||||
|
bin_names.each do |name|
|
||||||
|
if text =~ /test do.*system\s+['"]#{name}/m
|
||||||
|
problem %(fully scope test system calls e.g. system "\#{bin}/#{name}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if text =~ /xcodebuild[ (]["'*]/ && !text.include?("SYMROOT=")
|
if text =~ /xcodebuild[ (]["'*]/ && !text.include?("SYMROOT=")
|
||||||
problem 'xcodebuild should be passed an explicit "SYMROOT"'
|
problem 'xcodebuild should be passed an explicit "SYMROOT"'
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user