audit: recommend use of assert_match.

It produces significantly easier output to debug than doing `assert` and
`.include?` (which just shows if it passed or failed).

Closes Homebrew/homebrew#41662.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Mike McQuaid 2015-07-12 18:08:14 +01:00
parent b554c8bcca
commit 24b0639e27

View File

@ -794,6 +794,10 @@ class FormulaAuditor
problem "Use the `#{method}` Ruby method instead of `system #{system}`" problem "Use the `#{method}` Ruby method instead of `system #{system}`"
end end
if line =~ /assert .*\.include?/
problem "Use `assert_match` instead of `assert ...include?`"
end
if @strict if @strict
if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/ if line =~ /system (["'][^"' ]*(?:\s[^"' ]*)+["'])/
bad_system = $1 bad_system = $1