audit: check apache.org URLs
This commit is contained in:
parent
670227bdc8
commit
29006396dd
@ -41,6 +41,11 @@ module RuboCop
|
||||
problem "Please don't use fossies.org in the url (using as a mirror is fine)"
|
||||
end
|
||||
|
||||
apache_pattern = %r{^https?://(?:[^/]*\.)?apache\.org/(?:dyn/closer\.cgi\?path=/?|dist/)(.*)}i
|
||||
audit_urls(urls, apache_pattern) do |match, url|
|
||||
problem "#{url} should be `https://www.apache.org/dyn/closer.lua?path=#{match[1]}`"
|
||||
end
|
||||
|
||||
audit_urls(mirrors, /.*/) do |_, mirror|
|
||||
urls.each do |url|
|
||||
url_string = string_content(parameters(url).first)
|
||||
@ -58,7 +63,7 @@ module RuboCop
|
||||
%r{^http://ftpmirror\.gnu\.org/},
|
||||
%r{^http://download\.savannah\.gnu\.org/},
|
||||
%r{^http://download-mirror\.savannah\.gnu\.org/},
|
||||
%r{^http://[^/]*\.apache\.org/},
|
||||
%r{^http://(?:[^/]*\.)?apache\.org/},
|
||||
%r{^http://code\.google\.com/},
|
||||
%r{^http://fossies\.org/},
|
||||
%r{^http://mirrors\.kernel\.org/},
|
||||
@ -78,6 +83,11 @@ module RuboCop
|
||||
problem "Please use https:// for #{url}"
|
||||
end
|
||||
|
||||
apache_mirror_pattern = %r{^https?://(?:[^/]*\.)?apache\.org/dyn/closer\.(?:cgi|lua)\?path=/?(.*)}i
|
||||
audit_urls(mirrors, apache_mirror_pattern) do |match, mirror|
|
||||
problem "Please use `https://archive.apache.org/dist/#{match[1]}` as a mirror instead of #{mirror}."
|
||||
end
|
||||
|
||||
cpan_pattern = %r{^http://search\.mcpan\.org/CPAN/(.*)}i
|
||||
audit_urls(urls, cpan_pattern) do |match, url|
|
||||
problem "#{url} should be `https://cpan.metacpan.org/#{match[1]}`"
|
||||
|
||||
@ -18,6 +18,11 @@ describe RuboCop::Cop::FormulaAudit::Urls do
|
||||
"url" => "http://tools.ietf.org/tools/rfcmarkup/rfcmarkup-1.119.tgz",
|
||||
"msg" => "Please use https:// for http://tools.ietf.org/tools/rfcmarkup/rfcmarkup-1.119.tgz",
|
||||
"col" => 2,
|
||||
}, {
|
||||
"url" => "https://apache.org/dyn/closer.cgi?path=/apr/apr-1.7.0.tar.bz2",
|
||||
"msg" => "https://apache.org/dyn/closer.cgi?path=/apr/apr-1.7.0.tar.bz2 should be " \
|
||||
"`https://www.apache.org/dyn/closer.lua?path=apr/apr-1.7.0.tar.bz2`",
|
||||
"col" => 2,
|
||||
}, {
|
||||
"url" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz",
|
||||
"msg" => "http://search.mcpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.003.tar.gz should be " \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user