From d1d0bfc0ba0a225a9f77e44cda6de18256fc186a Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Mon, 6 May 2024 22:56:28 -0400 Subject: [PATCH 1/2] cask/audit: tune sourceforge.net URL regex --- Library/Homebrew/cask/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 0297849a96..77deaf1a23 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -868,7 +868,7 @@ module Cask sig { returns(T::Boolean) } def bad_sourceforge_url? - bad_url_format?(/sourceforge/, + bad_url_format?(%r{((downloads|\.dl)\.|//)sourceforge}, [ %r{\Ahttps://sourceforge\.net/projects/[^/]+/files/latest/download\Z}, %r{\Ahttps://downloads\.sourceforge\.net/(?!(project|sourceforge)/)}, From 4932fb7fd07937e4e49285da32520d318cb4644b Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Mon, 6 May 2024 22:57:23 -0400 Subject: [PATCH 2/2] rubocops/urls: remove dead link --- Library/Homebrew/rubocops/urls.rb | 5 +---- Library/Homebrew/test/rubocops/urls_spec.rb | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/rubocops/urls.rb b/Library/Homebrew/rubocops/urls.rb index f330387a41..b1808e41e0 100644 --- a/Library/Homebrew/rubocops/urls.rb +++ b/Library/Homebrew/rubocops/urls.rb @@ -143,10 +143,7 @@ module RuboCop end if url.match?(%r{^https?://prdownloads\.}) - problem <<~EOS.chomp - Don't use prdownloads in SourceForge urls (url is #{url}). - See: http://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/ - EOS + problem "Don't use prdownloads in SourceForge urls (url is #{url})." end if url.match?(%r{^http://\w+\.dl\.}) diff --git a/Library/Homebrew/test/rubocops/urls_spec.rb b/Library/Homebrew/test/rubocops/urls_spec.rb index fe52e72c50..80bf49199a 100644 --- a/Library/Homebrew/test/rubocops/urls_spec.rb +++ b/Library/Homebrew/test/rubocops/urls_spec.rb @@ -63,10 +63,8 @@ RSpec.describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "http://prdownloads.sourceforge.net/foo/foo-1.tar.gz", - "msg" => <<~EOS.chomp, - Don't use prdownloads in SourceForge urls (url is http://prdownloads.sourceforge.net/foo/foo-1.tar.gz). - See: http://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/ - EOS + "msg" => "Don't use prdownloads in SourceForge urls " \ + "(url is http://prdownloads.sourceforge.net/foo/foo-1.tar.gz).", "col" => 2, }, { "url" => "http://foo.dl.sourceforge.net/sourceforge/foozip/foozip_1.0.tar.bz2",