diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 587a83fb2c..7ac8a334a0 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -738,7 +738,7 @@ module Homebrew stable_url_minor_version = stable_url_version.minor.to_i formula_suffix = stable.version.patch.to_i - throttled_rate = formula.tap&.audit_exception(:throttled_formulae, formula.name) + throttled_rate = formula.livecheck.throttle if throttled_rate && formula_suffix.modulo(throttled_rate).nonzero? problem "should only be updated every #{throttled_rate} releases on multiples of #{throttled_rate}" end diff --git a/Library/Homebrew/test/formula_auditor_spec.rb b/Library/Homebrew/test/formula_auditor_spec.rb index f25a1920e2..930f8bb794 100644 --- a/Library/Homebrew/test/formula_auditor_spec.rb +++ b/Library/Homebrew/test/formula_auditor_spec.rb @@ -657,7 +657,7 @@ RSpec.describe Homebrew::FormulaAuditor do end describe "#audit_specs" do - let(:throttle_list) { { throttled_formulae: { "foo" => 10 } } } + let(:livecheck_throttle) { "livecheck do\n throttle 10\n end" } let(:versioned_head_spec_list) { { versioned_head_spec_allowlist: ["foo"] } } it "doesn't allow to miss a checksum" do @@ -696,7 +696,7 @@ RSpec.describe Homebrew::FormulaAuditor do end it "allows versions with no throttle rate" do - fa = formula_auditor "bar", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list + fa = formula_auditor "bar", <<~RUBY, core_tap: true class Bar < Formula url "https://brew.sh/foo-1.0.1.tgz" sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" @@ -708,10 +708,11 @@ RSpec.describe Homebrew::FormulaAuditor do end it "allows major/minor versions with throttle rate" do - fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list + fa = formula_auditor "foo", <<~RUBY, core_tap: true class Foo < Formula url "https://brew.sh/foo-1.0.0.tgz" sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + #{livecheck_throttle} end RUBY @@ -720,10 +721,11 @@ RSpec.describe Homebrew::FormulaAuditor do end it "allows patch versions to be multiples of the throttle rate" do - fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list + fa = formula_auditor "foo", <<~RUBY, core_tap: true class Foo < Formula url "https://brew.sh/foo-1.0.10.tgz" sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + #{livecheck_throttle} end RUBY @@ -732,10 +734,11 @@ RSpec.describe Homebrew::FormulaAuditor do end it "doesn't allow patch versions that aren't multiples of the throttle rate" do - fa = formula_auditor "foo", <<~RUBY, core_tap: true, tap_audit_exceptions: throttle_list + fa = formula_auditor "foo", <<~RUBY, core_tap: true class Foo < Formula url "https://brew.sh/foo-1.0.1.tgz" sha256 "31cccfc6630528db1c8e3a06f6decf2a370060b982841cfab2b8677400a5092e" + #{livecheck_throttle} end RUBY