audit(github): also permit refs/heads in GitHub URLs

This commit is contained in:
Mahrud Sayrafi 2023-10-28 00:53:49 -05:00
parent 13ca5c3984
commit eebffa8be3
No known key found for this signature in database
GPG Key ID: C24071B956C3245F

View File

@ -217,11 +217,11 @@ module RuboCop
problem "Use /archive/ URLs for GitHub tarballs (url is #{url})." problem "Use /archive/ URLs for GitHub tarballs (url is #{url})."
end end
archive_ref_tags_gh_pattern = %r{https://.*github.*/archive/(?![a-fA-F0-9]{40})(?!refs/tags/).*\.tar\.gz$} archive_refs_gh_pattern = %r{https://.*github.+/archive/(?![a-fA-F0-9]{40})(?!refs/(tags|heads)/)(.*)\.tar\.gz$}
audit_urls(urls, archive_ref_tags_gh_pattern) do |_, url| audit_urls(urls, archive_refs_gh_pattern) do |match, url|
next if url.end_with?(".git") 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 end
# Don't use GitHub .zip files # Don't use GitHub .zip files