audit: whitelist pipe, redirect etc in the system check
Closes Homebrew/homebrew#37523. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
f9ec5c5e62
commit
7d7081a18b
@ -714,9 +714,11 @@ class FormulaAuditor
|
|||||||
if @strict
|
if @strict
|
||||||
if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/
|
if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/
|
||||||
bad_system = $1
|
bad_system = $1
|
||||||
|
unless %w[| < > & ;].any? { |c| bad_system.include? c }
|
||||||
good_system = bad_system.gsub(" ", "\", \"")
|
good_system = bad_system.gsub(" ", "\", \"")
|
||||||
problem "Use `system #{good_system}` instead of `system #{bad_system}` "
|
problem "Use `system #{good_system}` instead of `system #{bad_system}` "
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if line =~ /(require ["']formula["'])/
|
if line =~ /(require ["']formula["'])/
|
||||||
problem "`#{$1}` is now unnecessary"
|
problem "`#{$1}` is now unnecessary"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user