diff --git a/Library/Homebrew/rubocops/uses_from_macos.rb b/Library/Homebrew/rubocops/uses_from_macos.rb index 57cc9b02c8..554a16b42c 100644 --- a/Library/Homebrew/rubocops/uses_from_macos.rb +++ b/Library/Homebrew/rubocops/uses_from_macos.rb @@ -59,8 +59,15 @@ module RuboCop return if PROVIDED_BY_MACOS_FORMULAE.include? @formula_name return if tap_style_exception? :provided_by_macos_formulae - problem "Formulae that are `keg_only :provided_by_macos` should be added to "\ - "`style_exceptions/provided_by_macos_formulae.json`" + message = if formula_tap == "homebrew-core" + "Formulae in homebrew/core that are `keg_only :provided_by_macos` should be "\ + "added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo)" + else + "Formulae that are `keg_only :provided_by_macos` should be added to "\ + "`style_exceptions/provided_by_macos_formulae.json`" + end + + problem message end end end diff --git a/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb b/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb index 5f09e9357e..a0035f2b3f 100644 --- a/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb +++ b/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb @@ -33,6 +33,18 @@ describe RuboCop::Cop::FormulaAudit::ProvidedByMacos do RUBY end + it "fails for homebrew-core formulae not in provided_by_macos_formulae list" do + expect_offense(<<~RUBY, "/homebrew-core/") + class Baz < Formula + url "https://brew.sh/baz-1.0.tgz" + homepage "https://brew.sh" + + keg_only :provided_by_macos + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core that are `keg_only :provided_by_macos` should be added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo) + end + RUBY + end + it "succeeds for formulae in provided_by_macos_formulae list" do setup_style_exceptions