brew audit - trailing whitespace detection
This commit is contained in:
parent
bc533d59c8
commit
6612a04917
@ -8,26 +8,33 @@ end
|
|||||||
|
|
||||||
ff.each do |f|
|
ff.each do |f|
|
||||||
text = ""
|
text = ""
|
||||||
|
problems = []
|
||||||
|
|
||||||
File.open(f.path, "r") { |afile| text = afile.read }
|
File.open(f.path, "r") { |afile| text = afile.read }
|
||||||
|
|
||||||
problems = []
|
if text =~ /# depends_on 'cmake'/
|
||||||
if /# depends_on 'cmake'/ =~ text
|
|
||||||
problems << " * Commented cmake support found."
|
problems << " * Commented cmake support found."
|
||||||
end
|
end
|
||||||
|
|
||||||
if /\?use_mirror=/ =~ text
|
if text =~ /\?use_mirror=/
|
||||||
problems << " * Remove 'use_mirror' from url."
|
problems << " * Remove 'use_mirror' from url."
|
||||||
end
|
end
|
||||||
|
|
||||||
# 2 (or more, if in an if block) spaces before depends_on, please
|
# 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'."
|
problems << " * Check indentation of 'depends_on'."
|
||||||
end
|
end
|
||||||
|
|
||||||
if /(#\{\w+\s*\+\s*['"][^}]+\})/ =~ text
|
if text =~ /(#\{\w+\s*\+\s*['"][^}]+\})/
|
||||||
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
|
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
|
||||||
end
|
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
|
aliases = Formula.aliases
|
||||||
f.deps.select {|d| aliases.include? d}.each do |d|
|
f.deps.select {|d| aliases.include? d}.each do |d|
|
||||||
problems << " * Dep #{d} is an alias; switch to the real name."
|
problems << " * Dep #{d} is an alias; switch to the real name."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user