From 95e3b43647f4c5a97eeea42e2b40ce13246b9aba Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 14 Apr 2023 18:55:29 +0200 Subject: [PATCH] Fix repo audit for discontinued casks. --- Library/Homebrew/cask/audit.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 8719434932..470a6a8e12 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -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 }