From 78cd6dc0a9ec899b689edae47c06fe9485e3d63f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 19 Sep 2020 04:30:41 +0200 Subject: [PATCH] =?UTF-8?q?Allow=20=E2=80=9CmacOS=20virtual=20machines?= =?UTF-8?q?=E2=80=9D=20in=20descriptions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/rubocops/shared/desc_helper.rb | 2 +- Library/Homebrew/test/rubocops/cask/desc_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/rubocops/shared/desc_helper.rb b/Library/Homebrew/rubocops/shared/desc_helper.rb index e393b7835b..8e43f1f39f 100644 --- a/Library/Homebrew/rubocops/shared/desc_helper.rb +++ b/Library/Homebrew/rubocops/shared/desc_helper.rb @@ -65,7 +65,7 @@ module RuboCop problem "Description shouldn't start with the #{type} name." if regex_match_group(desc, /^#{name_regex}\b/i) if type == :cask && - (match = regex_match_group(desc, /\b(macOS|Mac( ?OS( ?X)?)?|OS ?X)\b/i)) && + (match = regex_match_group(desc, /\b(macOS|Mac( ?OS( ?X)?)?|OS ?X)(?! virtual machines?)\b/i)) && match[1] != "MAC" problem "Description shouldn't contain the platform." end diff --git a/Library/Homebrew/test/rubocops/cask/desc_spec.rb b/Library/Homebrew/test/rubocops/cask/desc_spec.rb index 8b06c40a12..f27722b459 100644 --- a/Library/Homebrew/test/rubocops/cask/desc_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/desc_spec.rb @@ -93,6 +93,19 @@ describe RuboCop::Cop::Cask::Desc do end RUBY + expect_no_offenses <<~RUBY + cask 'foo' do + desc 'Application for managing macOS virtual machines' + end + RUBY + + expect_offense <<~RUBY + cask 'foo' do + desc 'Application for managing macOS virtual machines on macOS' + ^^^^^ Description shouldn\'t contain the platform. + end + RUBY + expect_no_offenses <<~RUBY cask 'foo' do desc 'MAC address changer'