From ab8054482b713e23f9fd18a68ca104267895a377 Mon Sep 17 00:00:00 2001 From: commitay Date: Wed, 11 Jul 2018 23:21:41 +1000 Subject: [PATCH] audit: check for optional and recommended requirements on new formulae --- Library/Homebrew/dev-cmd/audit.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 73788068f2..73dfbf21dd 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -363,6 +363,7 @@ module Homebrew @specs.each do |spec| # Check for things we don't like to depend on. # We allow non-Homebrew installs whenever possible. + options_message = "Formulae should not have optional or recommended dependencies" spec.deps.each do |dep| begin dep_f = dep.to_formula @@ -419,9 +420,15 @@ module Homebrew next unless @new_formula next unless @official_tap if dep.tags.include?(:recommended) || dep.tags.include?(:optional) - new_formula_problem "Formulae should not have #{dep.tags} dependencies." + new_formula_problem options_message end end + + next unless @new_formula + next unless @official_tap + if spec.requirements.map(&:recommended?).any? || spec.requirements.map(&:optional?).any? + new_formula_problem options_message + end end end