Skip to content

Commit

Permalink
Merge pull request #16155 from mahrud/quickfix/allow-branch-urls
Browse files Browse the repository at this point in the history
audit(github): also permit refs/heads in GitHub URLs
  • Loading branch information
Bo98 committed Oct 28, 2023
2 parents 97eda64 + eebffa8 commit 700c7de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Library/Homebrew/rubocops/urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "Use /archive/ URLs for GitHub tarballs (url is #{url})."
end

archive_ref_tags_gh_pattern = %r{https://.*github.*/archive/(?![a-fA-F0-9]{40})(?!refs/tags/).*\.tar\.gz$}
audit_urls(urls, archive_ref_tags_gh_pattern) do |_, url|
archive_refs_gh_pattern = %r{https://.*github.+/archive/(?![a-fA-F0-9]{40})(?!refs/(tags|heads)/)(.*)\.tar\.gz$}
audit_urls(urls, archive_refs_gh_pattern) do |match, url|
next if url.end_with?(".git")

problem "Use /archive/refs/tags URLs for GitHub tarballs (url is #{url})."
problem "Use refs/tags/#{match[2]} or refs/heads/#{match[2]} for GitHub references (url is #{url})."
end

# Don't use GitHub .zip files
Expand Down

0 comments on commit 700c7de

Please sign in to comment.