Merge pull request #8775 from reitermarkus/desc-macos-vm

Allow “macOS virtual machines” in descriptions.
This commit is contained in:
Markus Reiter 2020-09-19 06:34:58 +02:00 committed by GitHub
commit c110fb60a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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'