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:
		
							parent
							
								
									459fef3b09
								
							
						
					
					
						commit
						d5006ef012
					
				@ -1036,8 +1036,12 @@ class FormulaAuditor
 | 
				
			|||||||
      problem "#{$2} modules should be vendored rather than use deprecated `depends_on \"#{$1}\" => :#{$2}#{$3}`"
 | 
					      problem "#{$2} modules should be vendored rather than use deprecated `depends_on \"#{$1}\" => :#{$2}#{$3}`"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if line =~ /depends_on\s+['"](.+)['"]\s+=>\s+.*(?<!\?[( ])['"](.+)['"]/
 | 
					    if line =~ /depends_on\s+['"](.+)['"]\s+=>\s+(.*)/
 | 
				
			||||||
      problem "Dependency #{$1} should not use option #{$2}"
 | 
					      dep = $1
 | 
				
			||||||
 | 
					      $2.split(" ").map do |o|
 | 
				
			||||||
 | 
					        next unless o =~ /^\[?['"](.*)['"]/
 | 
				
			||||||
 | 
					        problem "Dependency #{dep} should not use option #{$1}"
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Commented-out depends_on
 | 
					    # Commented-out depends_on
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user