Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocops/shared/url_helper: tweak SourceForge handling #18631

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Library/Homebrew/rubocops/shared/url_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def audit_url(type, urls, mirrors, livecheck_url: false)
%r{^http://hackage\.haskell\.org/},
%r{^http://(?:[^/]*\.)?archive\.org},
%r{^http://(?:[^/]*\.)?freedesktop\.org},
%r{^http://(?:[^/]*\.)?mirrorservice\.org/}])
%r{^http://(?:[^/]*\.)?mirrorservice\.org/},
%r{^http://downloads?\.sourceforge\.net/}])
audit_urls(urls, http_to_https_patterns) do |_, url, index|
# It's fine to have a plain HTTP mirror further down the mirror list.
https_url = url.dup.insert(4, "s")
Expand Down Expand Up @@ -153,7 +154,7 @@ def audit_url(type, urls, mirrors, livecheck_url: false)

problem "Don't use /download in SourceForge urls (url is #{url})." if url.end_with?("/download")

if url.match?(%r{^https?://sourceforge\.}) && url != livecheck_url
if url.match?(%r{^https?://(sourceforge|sf)\.}) && url != livecheck_url
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})."
end

Expand All @@ -165,7 +166,10 @@ def audit_url(type, urls, mirrors, livecheck_url: false)
problem "Don't use specific dl mirrors in SourceForge urls (url is #{url})."
end

problem "Please use https:// for #{url}" if url.start_with? "http://downloads"
# sf.net does HTTPS -> HTTP redirects.
if url.match?(%r{^https?://downloads?\.sf\.net})
problem "Use https://downloads.sourceforge.net instead of downloads.sf.net (url is #{url})"
end
end

# Debian has an abundance of secure mirrors. Let's not pluck the insecure
Expand Down
Loading