From 777dc10aa85cf15d2c8248dae4d2a1f2907bebbc Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Fri, 6 Nov 2020 00:20:34 +1100 Subject: [PATCH 1/2] audit: deprecate requirements in core This strict audit ensures that new formulae that depend on Requirements like :x11, :java, and :osxfuse are not introduced into homebrew/core. --- Library/Homebrew/rubocops/lines.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 6705042323..4f60cfba17 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -665,6 +665,21 @@ module RuboCop end end + # This cop ensures that new formulae depending on Requirements are not introduced in homebrew/core. + class CoreRequirements < FormulaCop + def audit_formula(_node, _class_node, _parent_class_node, _body_node) + if depends_on? :java + problem "Formulae in homebrew/core should depend on a versioned `openjdk` instead of :java" + end + + if depends_on? :x11 + problem "Formulae in homebrew/core should depend on specific X libraries instead of :x11" + end + + problem ":osxfuse is deprecated in homebrew/core" if depends_on? :osxfuse + end + end + # This cop makes sure that shell command arguments are separated. # # @api private From 1b95059c2b1db0e45e9a10fb2040a90311bbdd3d Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Fri, 6 Nov 2020 00:49:48 +1100 Subject: [PATCH 2/2] Restrict audit to homebrew/core Co-authored-by: Mike McQuaid --- Library/Homebrew/rubocops/lines.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 4f60cfba17..89714fd103 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -668,6 +668,8 @@ module RuboCop # This cop ensures that new formulae depending on Requirements are not introduced in homebrew/core. class CoreRequirements < FormulaCop def audit_formula(_node, _class_node, _parent_class_node, _body_node) + return if formula_tap != "homebrew-core" + if depends_on? :java problem "Formulae in homebrew/core should depend on a versioned `openjdk` instead of :java" end