aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2014-03-06 20:40:15 +0000
committerMike McQuaid2014-03-08 00:54:35 +0000
commita5bed1ea312fb3936b5cd2f5b530fa5b841948a3 (patch)
treed40149e3335b8c4c8d29cd486d4c6715037fe7d8 /Library/Homebrew/cmd
parent1070acfe7ac95de63e736c3005efcdf1ce37b472 (diff)
downloadbrew-a5bed1ea312fb3936b5cd2f5b530fa5b841948a3.tar.bz2
audit: check for good with/without usage.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/audit.rb26
1 files changed, 21 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 1a81a55d1..dfc8f17c4 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -435,16 +435,32 @@ class FormulaAuditor
problem "Use 'build.head?' instead of inspecting 'version'"
end
- if line =~ /build\.include\?\s+['"]\-\-(.*)['"]/
+ if line =~ /build\.include\?[\s\(]+['"]\-\-(.*)['"]/
problem "Reference '#{$1}' without dashes"
end
- if line =~ /build\.with\?\s+['"]-?-?with-(.*)['"]/
- problem "No double 'with': Use `build.with? '#{$1}'` to check for \"--with-#{$1}\""
+ if line =~ /build\.include\?[\s\(]+['"]with(out)?-(.*)['"]/
+ problem "Use build.with#{$1}? \"#{$2}\" instead of build.include? 'with#{$1}-#{$2}'"
end
- if line =~ /build\.without\?\s+['"]-?-?without-(.*)['"]/
- problem "No double 'without': Use `build.without? '#{$1}'` to check for \"--without-#{$1}\""
+ if line =~ /build\.with\?[\s\(]+['"]-?-?with-(.*)['"]/
+ problem "Don't duplicate 'with': Use `build.with? \"#{$1}\"` to check for \"--with-#{$1}\""
+ end
+
+ if line =~ /build\.without\?[\s\(]+['"]-?-?without-(.*)['"]/
+ problem "Don't duplicate 'without': Use `build.without? \"#{$1}\"` to check for \"--without-#{$1}\""
+ end
+
+ if line =~ /unless build\.with(out)?\?/
+ problem "Don't use unless with 'build.with#{$1}': use 'if build.with#{$1}?'"
+ end
+
+ if line =~ /(not\s|!)\s*build\.with?\?/
+ problem "Don't negate 'build.without?': use 'build.with?'"
+ end
+
+ if line =~ /(not\s|!)\s*build\.without?\?/
+ problem "Don't negate 'build.with?': use 'build.without?'"
end
if line =~ /ARGV\.(?!(debug\?|verbose\?|value[\(\s]))/