aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-05-13 13:00:00 +0100
committerMike McQuaid2017-05-13 13:00:00 +0100
commitd5006ef01232cb2fc9829d3d07871d683f0202af (patch)
tree128936ea34c7bbc7a35e7fe0b6db6540403b14c8
parent459fef3b09b25d3e24cce6aa6f2e3a7bd5460a2b (diff)
downloadbrew-d5006ef01232cb2fc9829d3d07871d683f0202af.tar.bz2
audit: fix dependency option detection.
Instead of trying to do this all with a single regex give up and do a two stage process. Eventually I'll end up implementing a full ruby parser here :troll:.
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index cb25ca794..4ad302d5d 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -1036,8 +1036,12 @@ class FormulaAuditor
problem "#{$2} modules should be vendored rather than use deprecated `depends_on \"#{$1}\" => :#{$2}#{$3}`"
end
- if line =~ /depends_on\s+['"](.+)['"]\s+=>\s+.*(?<!\?[( ])['"](.+)['"]/
- problem "Dependency #{$1} should not use option #{$2}"
+ if line =~ /depends_on\s+['"](.+)['"]\s+=>\s+(.*)/
+ dep = $1
+ $2.split(" ").map do |o|
+ next unless o =~ /^\[?['"](.*)['"]/
+ problem "Dependency #{dep} should not use option #{$1}"
+ end
end
# Commented-out depends_on