From 08f58ab5f73e9e884cab30d68ad41295fa8f5d53 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 6 Sep 2023 23:29:06 +0100 Subject: [PATCH] Skip when the resource name is the same as the formula name - Otherwise we get an audit failure in, for example, the `twine-pypi` formula for the package name from its `url` that's actually `twine`. - For this we only should track `resource "name"` blocks. --- Library/Homebrew/resource_auditor.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/resource_auditor.rb b/Library/Homebrew/resource_auditor.rb index 3bf4cc912a..1f9b1c5a13 100644 --- a/Library/Homebrew/resource_auditor.rb +++ b/Library/Homebrew/resource_auditor.rb @@ -102,6 +102,7 @@ module Homebrew def audit_resource_name_matches_pypi_package_name_in_url return unless url.match?(%r{^https?://files\.pythonhosted\.org/packages/}) + return if name == owner.name # Skip the top-level package name as we only care about `resource "foo"` blocks. pypi_package_name = url.split("/").last.split(/[-.]\d+?./).first.gsub(/[_.]/, "-") return if name.casecmp(pypi_package_name).zero?