cask audit: review changes

This commit is contained in:
commitay 2018-06-05 19:20:38 +10:00
parent c354d76e47
commit b9b3952494
2 changed files with 16 additions and 16 deletions

View File

@ -255,14 +255,14 @@ module Hbc
def check_github_releases_appcast def check_github_releases_appcast
return unless cask.url.to_s =~ %r{github.com/([^/]+)/([^/]+)/releases/download/(\S+)} return unless cask.url.to_s =~ %r{github.com/([^/]+)/([^/]+)/releases/download/(\S+)}
add_warning "Cask uses GitHub releases, please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md" add_warning "Download uses GitHub releases, please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md"
end end
def check_sourceforge_appcast def check_sourceforge_appcast
return if cask.version.latest? return if cask.version.latest?
return unless cask.url.to_s =~ %r{sourceforge.net/(\S+)} return unless cask.url.to_s =~ %r{sourceforge.net/(\S+)}
add_warning "Cask hosted on SourceForge, please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md" add_warning "Download is hosted on SourceForge, please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md"
end end
def check_url def check_url

View File

@ -439,46 +439,46 @@ describe Hbc::Audit, :cask do
end end
describe "GitHub releases appcast check" do describe "GitHub releases appcast check" do
let(:error_msg) { /Cask uses GitHub releases/ } let(:appcast_warning) { /Download uses GitHub releases/ }
context "when the Cask does not use GitHub releases" do context "when the download does not use GitHub releases" do
let(:cask_token) { "basic-cask" } let(:cask_token) { "basic-cask" }
it { is_expected.not_to warn_with(error_msg) } it { is_expected.not_to warn_with(appcast_warning) }
end end
context "when the Cask uses GitHub releases and has an appcast" do context "when the download uses GitHub releases and has an appcast" do
let(:cask_token) { "github-with-appcast" } let(:cask_token) { "github-with-appcast" }
it { is_expected.not_to warn_with(error_msg) } it { is_expected.not_to warn_with(appcast_warning) }
end end
context "when the Cask uses GitHub releases and does not have an appcast" do context "when the download uses GitHub releases and does not have an appcast" do
let(:cask_token) { "github-without-appcast" } let(:cask_token) { "github-without-appcast" }
it { is_expected.to warn_with(error_msg) } it { is_expected.to warn_with(appcast_warning) }
end end
end end
describe "SourceForge appcast check" do describe "SourceForge appcast check" do
let(:error_msg) { /Cask hosted on SourceForge/ } let(:appcast_warning) { /Download is hosted on SourceForge/ }
context "when the Cask is not hosted on SourceForge" do context "when the download is not hosted on SourceForge" do
let(:cask_token) { "basic-cask" } let(:cask_token) { "basic-cask" }
it { is_expected.not_to warn_with(error_msg) } it { is_expected.not_to warn_with(appcast_warning) }
end end
context "when the Cask is hosted on SourceForge and has an appcast" do context "when the download is hosted on SourceForge and has an appcast" do
let(:cask_token) { "sourceforge-with-appcast" } let(:cask_token) { "sourceforge-with-appcast" }
it { is_expected.not_to warn_with(error_msg) } it { is_expected.not_to warn_with(appcast_warning) }
end end
context "when the Cask is hosted on SourceForge and does not have an appcast" do context "when the download is hosted on SourceForge and does not have an appcast" do
let(:cask_token) { "sourceforge-correct-url-format" } let(:cask_token) { "sourceforge-correct-url-format" }
it { is_expected.to warn_with(error_msg) } it { is_expected.to warn_with(appcast_warning) }
end end
end end