rubcops/provided_by_macos: fix wording for core formulae

This commit is contained in:
Rylan Polster 2020-12-02 21:19:17 -05:00
parent dcf3200980
commit 78060765b2
2 changed files with 21 additions and 2 deletions

View File

@ -59,9 +59,16 @@ module RuboCop
return if PROVIDED_BY_MACOS_FORMULAE.include? @formula_name return if PROVIDED_BY_MACOS_FORMULAE.include? @formula_name
return if tap_style_exception? :provided_by_macos_formulae return if tap_style_exception? :provided_by_macos_formulae
problem "Formulae that are `keg_only :provided_by_macos` should be added to "\ 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`" "`style_exceptions/provided_by_macos_formulae.json`"
end end
problem message
end
end end
end end

View File

@ -33,6 +33,18 @@ describe RuboCop::Cop::FormulaAudit::ProvidedByMacos do
RUBY RUBY
end 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 it "succeeds for formulae in provided_by_macos_formulae list" do
setup_style_exceptions setup_style_exceptions