Merge pull request #20461 from Homebrew/gnumirror

Update and temporarily disable GNU mirror audit
This commit is contained in:
Ruoyu Zhong 2025-08-14 14:40:30 +00:00 committed by GitHub
commit eb114387fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 10 deletions

View File

@ -41,11 +41,11 @@ module RuboCop
problem "Please use the ASCII (Punycode-encoded host, URL-encoded path and query) version of #{url}." problem "Please use the ASCII (Punycode-encoded host, URL-encoded path and query) version of #{url}."
end end
# GNU URLs; doesn't apply to mirrors # TODO: Re-add the following audit after homebrew/core migration.
gnu_pattern = %r{^(?:https?|ftp)://ftpmirror\.gnu\.org/(.*)} # gnu_pattern = %r{^(?:https?|ftp)://ftp\.gnu\.org/(.*)}
audit_urls(urls, gnu_pattern) do |match, url| # audit_urls(urls, gnu_pattern) do |match, url|
problem "#{url} should be: https://ftp.gnu.org/gnu/#{match[1]}" # problem "#{url} should be: https://ftpmirror.gnu.org/gnu/#{match[1]}"
end # end
# Fossies upstream requests they aren't used as primary URLs # Fossies upstream requests they aren't used as primary URLs
# https://github.com/Homebrew/homebrew-core/issues/14486#issuecomment-307753234 # https://github.com/Homebrew/homebrew-core/issues/14486#issuecomment-307753234

View File

@ -6,12 +6,14 @@ RSpec.describe RuboCop::Cop::FormulaAudit::Urls do
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
let(:offense_list) do let(:offense_list) do
# TODO: Re-add the following to the offense list after homebrew/core migration.
# {
# "url" => "https://ftpmirror.gnu.org/lightning/lightning-2.1.0.tar.gz",
# "msg" => "https://ftpmirror.gnu.org/lightning/lightning-2.1.0.tar.gz should be: " \
# "https://ftp.gnu.org/gnu/lightning/lightning-2.1.0.tar.gz",
# "col" => 2,
# }
[{ [{
"url" => "https://ftpmirror.gnu.org/lightning/lightning-2.1.0.tar.gz",
"msg" => "https://ftpmirror.gnu.org/lightning/lightning-2.1.0.tar.gz should be: " \
"https://ftp.gnu.org/gnu/lightning/lightning-2.1.0.tar.gz",
"col" => 2,
}, {
"url" => "https://fossies.org/linux/privat/monit-5.23.0.tar.gz", "url" => "https://fossies.org/linux/privat/monit-5.23.0.tar.gz",
"msg" => "Please don't use \"fossies.org\" in the `url` (using as a mirror is fine)", "msg" => "Please don't use \"fossies.org\" in the `url` (using as a mirror is fine)",
"col" => 2, "col" => 2,
@ -209,6 +211,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::Urls do
offenses = inspect_source(source) offenses = inspect_source(source)
expected_offenses.zip(offenses.reverse).each do |expected, actual| expected_offenses.zip(offenses.reverse).each do |expected, actual|
expect(actual).not_to be_nil
expect(actual.message).to eq(expected[:message]) expect(actual.message).to eq(expected[:message])
expect(actual.severity).to eq(expected[:severity]) expect(actual.severity).to eq(expected[:severity])
expect(actual.line).to eq(expected[:line]) expect(actual.line).to eq(expected[:line])