mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
formula_auditor: check livecheck throttle
Signed-off-by: Michael Cho <michael@michaelcho.dev>
This commit is contained in:
parent
c4ce3bebca
commit
2d50ef1bc0
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user