From 23575f3c7f4dc79129957f7dfb88ed11aa1619c0 Mon Sep 17 00:00:00 2001
From: Tobias Lidskog <tobias@lidskog.se>
Date: Thu, 21 Feb 2013 09:56:30 +0100
Subject: [PATCH] audit: correct inverted has_trailing_newline condition

has_trailing_newline? checked if formula did not have a trailing
newline. Invert regex and invert audit check.

Closes Homebrew/homebrew#18359.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
---
 Library/Homebrew/cmd/audit.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 3b1733e0ba..74f18c367e 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -68,7 +68,7 @@ class FormulaText
   end
 
   def has_trailing_newline?
-    /.+\z/ =~ @text
+    /\Z\n/ =~ @text
   end
 end
 
@@ -112,7 +112,7 @@ class FormulaAuditor
       problem "'__END__' was found, but 'DATA' is not used"
     end
 
-    if f.text.has_trailing_newline?
+    unless f.text.has_trailing_newline?
       problem "File should end with a newline"
     end
   end
-- 
GitLab