audit: suggest proper if build.with(out) usage

Closes Homebrew/homebrew#27759.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Ian Lancaster 2014-03-21 06:08:18 -04:00 committed by Mike McQuaid
parent a105c69214
commit 58456a5469

View File

@ -462,8 +462,12 @@ class FormulaAuditor
problem "Don't duplicate 'without': Use `build.without? \"#{$1}\"` to check for \"--without-#{$1}\"" problem "Don't duplicate 'without': Use `build.without? \"#{$1}\"` to check for \"--without-#{$1}\""
end end
if line =~ /unless build\.with(out)?\?/ if line =~ /unless build\.with\?(.*)/
problem "Don't use unless with 'build.with#{$1}': use 'if build.with#{$1}?'" problem "Use if build.without?#{$1} instead of unless build.with?#{$1}"
end
if line =~ /unless build\.without\?(.*)/
problem "Use if build.with?#{$1} instead of unless build.without?#{$1}"
end end
if line =~ /(not\s|!)\s*build\.with?\?/ if line =~ /(not\s|!)\s*build\.with?\?/