rubocops/lines: disallow quictls dependencies in homebrew/core

QuicTLS is a fork of OpenSSL that adds support for QUIC. We'll probably
end up adding it to homebrew/core at some point (see
Homebrew/homebrew-core#134975), but I don't think we want to actually
use it as a dependency of any formulae in place of OpenSSL.

We ought to only allow it for software that actually require QuicTLS in
place of OpenSSL, but I'm not aware of any existing formulae that have
this requirement.
This commit is contained in:
Carlo Cabrera 2023-07-01 23:07:28 +08:00
parent 9a482dea2b
commit 83f2a69acb
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -219,6 +219,27 @@ module RuboCop
end
end
# This cop makes sure that formulae depend on `openssl` instead of `quictls`.
#
# @api private
class QuicTLSCheck < FormulaCop
extend AutoCorrector
def audit_formula(_node, _class_node, _parent_class_node, body_node)
return if body_node.nil?
# Enforce use of OpenSSL for TLS dependency in core
return if formula_tap != "homebrew-core"
find_method_with_args(body_node, :depends_on, "quictls") do
problem "Formulae in homebrew/core should use 'depends_on \"openssl@3\"' " \
"instead of '#{@offensive_node.source}'." do |corrector|
corrector.replace(@offensive_node.source_range, "depends_on \"openssl@3\"")
end
end
end
end
# This cop makes sure that formulae do not depend on `pyoxidizer` at build-time
# or run-time.
#