From 0d9e28d305b2d0513e3f6d9a4fadc7cd646acb3b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 11 Aug 2020 21:22:41 +0200 Subject: [PATCH] Don't warn about version designation in `cask-versions` tap. --- Library/Homebrew/cask/audit.rb | 6 ++++-- Library/Homebrew/test/cask/audit_spec.rb | 14 +++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 5e21b2fc21..05b01042ba 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -380,8 +380,10 @@ module Cask add_warning "cask token contains .app" if token.end_with? ".app" - if cask.token.end_with? "alpha", "beta", "release candidate" - add_warning "cask token contains version designation" + if /-(?alpha|beta|rc|release-candidate)$/ =~ cask.token + if cask.tap.official? && cask.tap != "homebrew/cask-versions" + add_warning "cask token contains version designation '#{designation}'" + end end add_warning "cask token mentions launcher" if token.end_with? "launcher" diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 7bcbc3b0a2..b96b89faf2 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -212,11 +212,19 @@ describe Cask::Audit, :cask do end end - context "when cask token contains version" do + context "when cask token contains version designation" do let(:cask_token) { "token-beta" } - it "warns about version in token" do - expect(subject).to warn_with(/token contains version/) + it "warns about version in token if the cask is from an official tap" do + allow(cask).to receive(:tap).and_return(Tap.fetch("homebrew/cask")) + + expect(subject).to warn_with(/token contains version designation/) + end + + it "does not warn about version in token if the cask is from the `cask-versions` tap" do + allow(cask).to receive(:tap).and_return(Tap.fetch("homebrew/cask-versions")) + + expect(subject).not_to warn_with(/token contains version designation/) end end