Merge pull request #15228 from reitermarkus/audit-repo-discontinued

Fix repo audit for discontinued casks.
This commit is contained in:
Markus Reiter 2023-04-15 12:39:10 +02:00 committed by GitHub
commit b67fffbc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -634,6 +634,9 @@ module Cask
sig { void }
def audit_github_repository_archived
# Discontinued casks may have an archived repo.
return if cask.discontinued?
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if online?
return if user.nil?
@ -641,14 +644,15 @@ module Cask
metadata = SharedAudits.github_repo_data(user, repo)
return if metadata.nil?
return unless metadata["archived"]
# Discontinued casks shouldn't show up as errors.
add_error("GitHub repo is archived", strict_only: !cask.discontinued?)
add_error "GitHub repo is archived" if metadata["archived"]
end
sig { void }
def audit_gitlab_repository_archived
# Discontinued casks may have an archived repo.
return if cask.discontinued?
user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if online?
return if user.nil?
@ -656,10 +660,8 @@ module Cask
metadata = SharedAudits.gitlab_repo_data(user, repo)
return if metadata.nil?
return unless metadata["archived"]
# Discontinued casks shouldn't show up as errors.
add_error("GitLab repo is archived") unless cask.discontinued?
add_error "GitLab repo is archived" if metadata["archived"]
end
sig { void }