Merge pull request #10260 from reitermarkus/audit-livecheck
Improve audit for `livecheck` in casks.
This commit is contained in:
commit
028e733e79
@ -67,6 +67,7 @@ module Cask
|
|||||||
check_single_uninstall_zap
|
check_single_uninstall_zap
|
||||||
check_untrusted_pkg
|
check_untrusted_pkg
|
||||||
check_hosting_with_appcast
|
check_hosting_with_appcast
|
||||||
|
check_appcast_and_livecheck
|
||||||
check_latest_with_appcast_or_livecheck
|
check_latest_with_appcast_or_livecheck
|
||||||
check_latest_with_auto_updates
|
check_latest_with_auto_updates
|
||||||
check_stanza_requires_uninstall
|
check_stanza_requires_uninstall
|
||||||
@ -283,18 +284,24 @@ module Cask
|
|||||||
add_error "cannot use the sha256 for an empty string: #{empty_sha256}"
|
add_error "cannot use the sha256 for an empty string: #{empty_sha256}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_appcast_and_livecheck
|
||||||
|
return unless cask.appcast
|
||||||
|
|
||||||
|
add_error "Cask has a `livecheck`, the `appcast` should be removed." if cask.livecheckable?
|
||||||
|
end
|
||||||
|
|
||||||
def check_latest_with_appcast_or_livecheck
|
def check_latest_with_appcast_or_livecheck
|
||||||
return unless cask.version.latest?
|
return unless cask.version.latest?
|
||||||
|
|
||||||
add_error "Casks with an appcast should not use version :latest" if cask.appcast
|
add_error "Casks with an `appcast` should not use `version :latest`." if cask.appcast
|
||||||
add_error "Casks with a livecheck should not use version :latest" if cask.livecheckable?
|
add_error "Casks with a `livecheck` should not use `version :latest`." if cask.livecheckable?
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_latest_with_auto_updates
|
def check_latest_with_auto_updates
|
||||||
return unless cask.version.latest?
|
return unless cask.version.latest?
|
||||||
return unless cask.auto_updates
|
return unless cask.auto_updates
|
||||||
|
|
||||||
add_error "Casks with `version :latest` should not use `auto_updates`"
|
add_error "Casks with `version :latest` should not use `auto_updates`."
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_hosting_with_appcast
|
def check_hosting_with_appcast
|
||||||
|
|||||||
@ -647,7 +647,7 @@ describe Cask::Audit, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "latest with appcast checks" do
|
describe "latest with appcast checks" do
|
||||||
let(:message) { "Casks with an appcast should not use version :latest" }
|
let(:message) { "Casks with an `appcast` should not use `version :latest`." }
|
||||||
|
|
||||||
context "when the Cask is :latest and does not have an appcast" do
|
context "when the Cask is :latest and does not have an appcast" do
|
||||||
let(:cask_token) { "version-latest" }
|
let(:cask_token) { "version-latest" }
|
||||||
@ -691,7 +691,7 @@ describe Cask::Audit, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "latest with auto_updates checks" do
|
describe "latest with auto_updates checks" do
|
||||||
let(:message) { "Casks with `version :latest` should not use `auto_updates`" }
|
let(:message) { "Casks with `version :latest` should not use `auto_updates`." }
|
||||||
|
|
||||||
context "when the Cask is :latest and does not have auto_updates" do
|
context "when the Cask is :latest and does not have auto_updates" do
|
||||||
let(:cask_token) { "version-latest" }
|
let(:cask_token) { "version-latest" }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user