aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-08-07 15:23:13 -0700
committerAdam Vandenberg2010-08-07 18:08:51 -0700
commitf207fd0ef587d76b32e70a02903293c3affc727f (patch)
treef753de2b5c73489c1fbd6ccfa0f82d8e89b56f66 /Library
parent421bc6cdbc985a2c26f87b7ac774181f2b655702 (diff)
downloadhomebrew-f207fd0ef587d76b32e70a02903293c3affc727f.tar.bz2
brew audit - trailing whitespace detection
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-audit.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/Library/Contributions/examples/brew-audit.rb b/Library/Contributions/examples/brew-audit.rb
index dbc74908e..cceda040f 100755
--- a/Library/Contributions/examples/brew-audit.rb
+++ b/Library/Contributions/examples/brew-audit.rb
@@ -8,26 +8,33 @@ end
ff.each do |f|
text = ""
+ problems = []
+
File.open(f.path, "r") { |afile| text = afile.read }
- problems = []
- if /# depends_on 'cmake'/ =~ text
+ if text =~ /# depends_on 'cmake'/
problems << " * Commented cmake support found."
end
- if /\?use_mirror=/ =~ text
+ if text =~ /\?use_mirror=/
problems << " * Remove 'use_mirror' from url."
end
# 2 (or more, if in an if block) spaces before depends_on, please
- if /^\ ?depends_on/ =~ text
+ if text =~ /^\ ?depends_on/
problems << " * Check indentation of 'depends_on'."
end
- if /(#\{\w+\s*\+\s*['"][^}]+\})/ =~ text
+ if text =~ /(#\{\w+\s*\+\s*['"][^}]+\})/
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
end
+ # Don't complain about spaces in patches
+ split_patch = (text.split("__END__")[0]).strip()
+ if split_patch =~ /[ ]+$/
+ problems << " * Trailing whitespace was found."
+ end
+
aliases = Formula.aliases
f.deps.select {|d| aliases.include? d}.each do |d|
problems << " * Dep #{d} is an alias; switch to the real name."