rubocops/uses_from_macos: update list.
Also, provide details on how to update this in future and split it into two. Fixes #7396
This commit is contained in:
parent
929d8fccc8
commit
cddc67b451
@ -7,42 +7,72 @@ module RuboCop
|
|||||||
module FormulaAudit
|
module FormulaAudit
|
||||||
# This cop audits `uses_from_macos` dependencies in formulae
|
# This cop audits `uses_from_macos` dependencies in formulae
|
||||||
class UsesFromMacos < FormulaCop
|
class UsesFromMacos < FormulaCop
|
||||||
ALLOWED_USES_FROM_MACOS_DEPS = %w[
|
# Generate with:
|
||||||
|
# brew ruby -e 'puts Formula.select {|f| f.keg_only_reason&.provided_by_macos? }.map(&:name).sort.join("\n")'
|
||||||
|
# Not done at runtime as its too slow and RuboCop doesn't have access.
|
||||||
|
PROVIDED_BY_MACOS_FORMULAE = %w[
|
||||||
|
apr
|
||||||
|
bc
|
||||||
bison
|
bison
|
||||||
bzip2
|
bzip2
|
||||||
|
cups
|
||||||
curl
|
curl
|
||||||
|
dyld-headers
|
||||||
expat
|
expat
|
||||||
expect
|
file-formula
|
||||||
flex
|
flex
|
||||||
groff
|
gcore
|
||||||
|
gnu-getopt
|
||||||
icu4c
|
icu4c
|
||||||
krb5
|
krb5
|
||||||
|
libarchive
|
||||||
libedit
|
libedit
|
||||||
libffi
|
libffi
|
||||||
libiconv
|
libiconv
|
||||||
libpcap
|
libpcap
|
||||||
|
libressl
|
||||||
libxml2
|
libxml2
|
||||||
libxslt
|
libxslt
|
||||||
llvm
|
llvm
|
||||||
|
lsof
|
||||||
m4
|
m4
|
||||||
|
ncompress
|
||||||
ncurses
|
ncurses
|
||||||
|
net-snmp
|
||||||
openldap
|
openldap
|
||||||
openssl@1.1
|
openlibm
|
||||||
perl
|
pod2man
|
||||||
php
|
rpcgen
|
||||||
ruby
|
ruby
|
||||||
sqlite
|
sqlite
|
||||||
ssh-copy-id
|
ssh-copy-id
|
||||||
|
swift
|
||||||
tcl-tk
|
tcl-tk
|
||||||
texinfo
|
texinfo
|
||||||
|
unifdef
|
||||||
unzip
|
unzip
|
||||||
vim
|
|
||||||
xz
|
|
||||||
zip
|
zip
|
||||||
zlib
|
zlib
|
||||||
zsh
|
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
# These formulae aren't keg_only :provided_by_macos but are provided by
|
||||||
|
# macOS (or very similarly e.g. OpenSSL where system provides LibreSSL)
|
||||||
|
# TODO: consider making some of these keg-only.
|
||||||
|
ALLOWED_USES_FROM_MACOS_DEPS = (PROVIDED_BY_MACOS_FORMULAE + %w[
|
||||||
|
bash
|
||||||
|
expect
|
||||||
|
groff
|
||||||
|
openssl
|
||||||
|
openssl@1.1
|
||||||
|
perl
|
||||||
|
php
|
||||||
|
python
|
||||||
|
python@3
|
||||||
|
vim
|
||||||
|
xz
|
||||||
|
zsh
|
||||||
|
]).freeze
|
||||||
|
|
||||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||||
find_method_with_args(body_node, :uses_from_macos, /^"(.+)"/).each do |method|
|
find_method_with_args(body_node, :uses_from_macos, /^"(.+)"/).each do |method|
|
||||||
dep = if parameters(method).first.class == RuboCop::AST::StrNode
|
dep = if parameters(method).first.class == RuboCop::AST::StrNode
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
shared_examples "formulae exist" do |array|
|
shared_examples "formulae exist" do |array|
|
||||||
array.each do |f|
|
array.each do |f|
|
||||||
it "#{f} formula exists" do
|
it "#{f} formula exists" do
|
||||||
formula_path = Pathname("#{HOMEBREW_LIBRARY_PATH}/../Taps/homebrew/homebrew-core/Formula/#{f}.rb")
|
core_tap = Pathname("#{HOMEBREW_LIBRARY_PATH}/../Taps/homebrew/homebrew-core")
|
||||||
expect(formula_path.exist?).to be true
|
formula_path = core_tap/"Formula/#{f}.rb"
|
||||||
|
alias_path = core_tap/"Aliases/#{f}"
|
||||||
|
expect(formula_path.exist? || alias_path.exist?).to be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user