Use #grep where it will suffice

This commit is contained in:
Jack Nagel 2013-04-05 22:00:36 -05:00
parent 9f9608e6c5
commit 62a0b3f18d
2 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ class FormulaAuditor
urls = [(f.stable.url rescue nil), (f.devel.url rescue nil), (f.head.url rescue nil)].compact
# Check GNU urls; doesn't apply to mirrors
urls.select { |u| u =~ %r[^(https?|ftp)://(?!alpha).+/gnu/] }.each do |u|
urls.grep(%r[^(https?|ftp)://(?!alpha).+/gnu/]).each do |u|
problem "\"ftpmirror.gnu.org\" is preferred for GNU software (url is #{u})."
end
@ -230,12 +230,12 @@ class FormulaAuditor
end
# Check for git:// GitHub repo urls, https:// is preferred.
urls.select { |u| u =~ %r[^git://([^/])*github\.com/] }.each do |u|
urls.grep(%r[^git://([^/])*github\.com/]).each do |u|
problem "Use https:// URLs for accessing GitHub repositories (url is #{u})."
end
# Check for http:// GitHub repo urls, https:// is preferred.
urls.select { |u| u =~ %r[^http://github\.com/.*\.git$] }.each do |u|
urls.grep(%r[^http://github\.com/.*\.git$]).each do |u|
problem "Use https:// URLs for accessing GitHub repositories (url is #{u})."
end

View File

@ -1095,7 +1095,7 @@ module Homebrew extend self
checks = Checks.new
if ARGV.include? '--list-checks'
checks.methods.select { |m| m =~ /^check_/ }.sort.each { |m| puts m }
checks.methods.grep(/^check_/).sort.each { |m| puts m }
exit
end
@ -1106,7 +1106,7 @@ module Homebrew extend self
checks.methods.sort << "check_for_linked_keg_only_brews" << "check_for_outdated_homebrew"
else
ARGV.named
end.select{ |method| method =~ /^check_/ }.reverse.uniq.reverse
end.grep(/^check_/).reverse.uniq.reverse
first_warning = true
methods.each do |method|