From 8a74e648e7dea3a350ac9b8f1054d60df34dc160 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 22 Apr 2013 15:06:42 -0500 Subject: [PATCH] audit: warn about top-level methods --- Library/Homebrew/cmd/audit.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 8b773345db..2ed56da803 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -442,6 +442,10 @@ class FormulaAuditor if text =~ /depends_on [A-Z][\w:]+\.new$/ problem "`depends_on` can take requirement classes instead of instances" end + + if text =~ /^def (\w+).*$/ + problem "Define method #{$1.inspect} in the class body, not at the top-level" + end end def audit