LinkageChecker: simplify logic (#538)

BuiltOptions#without? already handles the option_names for dependencies.

Also check disabled recommended deps.
This commit is contained in:
Xu Cheng 2016-07-18 18:07:00 +08:00 committed by GitHub
parent a3a6a8381d
commit 91a47a9ed6

View File

@ -53,7 +53,8 @@ class LinkageChecker
def check_undeclared_deps
filter_out = proc do |dep|
next true if dep.build?
dep.optional? && !dep.option_names.any? { |n| formula.build.with?(n) }
next false unless dep.optional? || dep.recommended?
formula.build.without?(dep)
end
declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name)
declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact