diff options
| author | Andrew Janke | 2015-10-05 05:38:50 -0400 | 
|---|---|---|
| committer | Baptiste Fontaine | 2015-10-07 09:41:24 +0200 | 
| commit | 4c80bf4324956e39073eb7d13c144cdcd0f64fba (patch) | |
| tree | a7d7fc3012dbaac88002ef44fa0c124fb620a858 | |
| parent | 2d60187e1a7e168e497fdcc1ba010c963081fc17 (diff) | |
| download | brew-4c80bf4324956e39073eb7d13c144cdcd0f64fba.tar.bz2 | |
audit: add check for 'head' and 'head do' both present
Closes Homebrew/homebrew#44626.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 8c8eb0357..3b27c28f5 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -179,15 +179,20 @@ class FormulaAuditor        [/^  test do/,                       "test block"]      ] -    component_list.map do |regex, name| +    present = component_list.map do |regex, name|        lineno = text.line_number regex        next unless lineno        [lineno, name] -    end.compact.each_cons(2) do |c1, c2| +    end.compact +    present.each_cons(2) do |c1, c2|        unless c1[0] < c2[0]          problem "`#{c1[1]}` (line #{c1[0]}) should be put before `#{c2[1]}` (line #{c2[0]})"        end      end +    present.map!(&:last) +    if present.include?("head") && present.include?("head block") +      problem "Should not have both `head` and `head do`" +    end    end    def audit_class  | 
