Skip to content

Commit 01800d0

Browse files
committed
formula_auditor: skip PyPI resource audit for deprecated formulae
Signed-off-by: botantony <antonsm21@gmail.com>
1 parent 7023f18 commit 01800d0

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

Library/Homebrew/formula_auditor.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,9 @@ def audit_specs
763763
problem "Resource name should be different from the formula name" if resource.name == formula.name
764764

765765
except = @except
766-
except = [*Array(except), "pypi_resources"] if allowed_pypi_packages.include?(resource.name)
766+
if allowed_pypi_packages.include?(resource.name) || formula.deprecated?
767+
except = [*Array(except), "pypi_resources"]
768+
end
767769

768770
ra = ResourceAuditor.new(
769771
resource, spec_name,

Library/Homebrew/test/formula_auditor_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,31 @@ class Foo < Formula
619619
expect(fa.problems).to be_empty
620620
end
621621

622+
it "doesn't report a problem if formula is deprecated" do
623+
fa = formula_auditor("foo", <<~RUBY, tap_audit_exceptions: {}, pypi_dependencies_formulae:)
624+
class Foo < Formula
625+
url "https://brew.sh/foo-1.0.tgz"
626+
sha256 "abc123"
627+
homepage "https://brew.sh"
628+
629+
deprecate! date: "2026-01-01", because: "some reasone"
630+
631+
resource "bar" do
632+
url "https://files.pythonhosted.org/packages/00/00/aaaa/bar-1.0.0.tar.gz"
633+
sha256 "def456"
634+
end
635+
636+
resource "baz" do
637+
url "https://files.pythonhosted.org/packages/00/00/aaaa/baz-1.0.0.tar.gz"
638+
sha256 "ghi789"
639+
end
640+
end
641+
RUBY
642+
643+
fa.audit_specs
644+
expect(fa.problems).to be_empty
645+
end
646+
622647
it "doesn't audit PyPI package if it is not a resource" do
623648
fa = formula_auditor("bar", <<~RUBY, tap_audit_exceptions: {}, pypi_dependencies_formulae:)
624649
class Bar < Formula

0 commit comments

Comments
 (0)