From af4aff8c13ffd952ce6217616fae02d9f27c0c89 Mon Sep 17 00:00:00 2001 From: Lee Hanxue Date: Wed, 20 Nov 2013 00:00:36 +0800 Subject: [PATCH] brew audit: show line number for whitespace Closes Homebrew/homebrew#24481. Closes Homebrew/homebrew#24490. --- Library/Homebrew/cmd/audit.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 509cef8303..9f86577bea 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -332,7 +332,7 @@ class FormulaAuditor end end - def audit_line(line) + def audit_line(line, lineno) if line =~ /<(Formula|AmazonWebServicesFormula|ScriptFileFormula|GithubGistFormula)/ problem "Use a space in class inheritance: class Foo < #{$1}" end @@ -410,7 +410,7 @@ class FormulaAuditor # No trailing whitespace, please if line =~ /[\t ]+$/ - problem "Trailing whitespace was found" + problem "#{lineno}: Trailing whitespace was found" end if line =~ /if\s+ARGV\.include\?\s+'--(HEAD|devel)'/ @@ -568,7 +568,7 @@ class FormulaAuditor audit_conflicts audit_patches audit_text - text.each_line { |line| audit_line(line) } + text.split("\n").each_with_index { |line, lineno| audit_line(line, lineno) } audit_installed end