From ca35e0ff11ca2eddb2fb57ed99ec034aa8069c0d Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 10 Feb 2023 22:02:17 +0800 Subject: [PATCH] formula_auditor: allow references to closed PRs The `github_issue_comment` audit disallows references to closed or merged PRs in other repositories. We should allow those, since it is a common pattern to reference merged PRs in formulae when adding comments that explain changes that need to be made in future versions (e.g. `patch` blocks). --- Library/Homebrew/formula_auditor.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 50ed3f2ff3..67e0cc6b35 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -829,7 +829,9 @@ module Homebrew next if "#{owner}/#{repo}" == formula.tap.remote_repo || owner == "Homebrew" issue = GitHub::API.open_rest("https://api.github.com/repos/#{owner}/#{repo}/issues/#{id}") - next if issue.blank? || issue["state"] == "open" + next if issue.blank? + next if issue["pull_request"].present? + next if issue["state"] == "open" issue_url = "https://github.com/#{owner}/#{repo}/#{type}/#{id}" problem "Formula refers to a GitHub issue or pull request that is closed: #{issue_url}"