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 🧌.
This commit is contained in:
Mike McQuaid 2017-05-13 13:00:00 +01:00
parent 459fef3b09
commit d5006ef012

View File

@ -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