Merge pull request #7703 from issyl0/allowlist-and-denylist
Use "allowlist" and "denylist" instead of "whitelist" and "blacklist"
This commit is contained in:
commit
5a63636529
@ -74,7 +74,7 @@ Naming/PredicateName:
|
||||
# can't rename these
|
||||
AllowedMethods: is_32_bit?, is_64_bit?
|
||||
|
||||
# whitelist those that are standard
|
||||
# allow those that are standard
|
||||
# TODO: try to remove some of these
|
||||
Naming/MethodParameterName:
|
||||
AllowedNames:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cask/blacklist"
|
||||
require "cask/denylist"
|
||||
require "cask/checkable"
|
||||
require "cask/download"
|
||||
require "digest"
|
||||
@ -32,7 +32,7 @@ module Cask
|
||||
end
|
||||
|
||||
def run!
|
||||
check_blacklist
|
||||
check_denylist
|
||||
check_required_stanzas
|
||||
check_version
|
||||
check_sha256
|
||||
@ -370,11 +370,11 @@ module Cask
|
||||
[user, repo]
|
||||
end
|
||||
|
||||
def check_blacklist
|
||||
def check_denylist
|
||||
return if cask.tap&.user != "Homebrew"
|
||||
return unless reason = Blacklist.blacklisted_reason(cask.token)
|
||||
return unless reason = Denylist.reason(cask.token)
|
||||
|
||||
add_error "#{cask.token} is blacklisted: #{reason}"
|
||||
add_error "#{cask.token} is not allowed: #{reason}"
|
||||
end
|
||||
|
||||
def check_https_availability
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Cask
|
||||
module Blacklist
|
||||
def self.blacklisted_reason(name)
|
||||
module Denylist
|
||||
def self.reason(name)
|
||||
case name
|
||||
when /^adobe-(after|illustrator|indesign|photoshop|premiere)/
|
||||
"Adobe casks were removed because they are too difficult to maintain."
|
||||
@ -309,7 +309,7 @@ module Homebrew
|
||||
|
||||
name = formula.name
|
||||
|
||||
problem "'#{name}' is blacklisted from homebrew/core." if MissingFormula.blacklisted_reason(name)
|
||||
problem "'#{name}' is not allowed in homebrew/core." if MissingFormula.disallowed_reason(name)
|
||||
|
||||
if Formula.aliases.include? name
|
||||
problem "Formula name conflicts with existing aliases in homebrew/core."
|
||||
@ -327,7 +327,7 @@ module Homebrew
|
||||
problem "Formula name conflicts with existing core formula."
|
||||
end
|
||||
|
||||
USES_FROM_MACOS_WHITELIST = %w[
|
||||
USES_FROM_MACOS_ALLOWLIST = %w[
|
||||
apr
|
||||
apr-util
|
||||
openblas
|
||||
@ -369,7 +369,7 @@ module Homebrew
|
||||
dep_f.keg_only? &&
|
||||
dep_f.keg_only_reason.provided_by_macos? &&
|
||||
dep_f.keg_only_reason.applicable? &&
|
||||
!USES_FROM_MACOS_WHITELIST.include?(dep.name)
|
||||
!USES_FROM_MACOS_ALLOWLIST.include?(dep.name)
|
||||
new_formula_problem(
|
||||
"Dependency '#{dep.name}' is provided by macOS; " \
|
||||
"please replace 'depends_on' with 'uses_from_macos'.",
|
||||
@ -441,7 +441,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
VERSIONED_KEG_ONLY_WHITELIST = %w[
|
||||
VERSIONED_KEG_ONLY_ALLOWLIST = %w[
|
||||
autoconf@2.13
|
||||
bash-completion@2
|
||||
gnupg@1.4
|
||||
@ -463,7 +463,7 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
return if VERSIONED_KEG_ONLY_WHITELIST.include?(formula.name) || formula.name.start_with?("gcc@")
|
||||
return if VERSIONED_KEG_ONLY_ALLOWLIST.include?(formula.name) || formula.name.start_with?("gcc@")
|
||||
|
||||
problem "Versioned formulae in homebrew/core should use `keg_only :versioned_formula`"
|
||||
end
|
||||
@ -552,19 +552,19 @@ module Homebrew
|
||||
[user, repo]
|
||||
end
|
||||
|
||||
VERSIONED_HEAD_SPEC_WHITELIST = %w[
|
||||
VERSIONED_HEAD_SPEC_ALLOWLIST = %w[
|
||||
bash-completion@2
|
||||
imagemagick@6
|
||||
].freeze
|
||||
|
||||
THROTTLED_BLACKLIST = {
|
||||
THROTTLED_DENYLIST = {
|
||||
"aws-sdk-cpp" => "10",
|
||||
"awscli@1" => "10",
|
||||
"quicktype" => "10",
|
||||
"vim" => "50",
|
||||
}.freeze
|
||||
|
||||
UNSTABLE_WHITELIST = {
|
||||
UNSTABLE_ALLOWLIST = {
|
||||
"aalib" => "1.4rc",
|
||||
"automysqlbackup" => "3.0-rc",
|
||||
"aview" => "1.3.0rc",
|
||||
@ -582,7 +582,7 @@ module Homebrew
|
||||
"vbindiff" => "3.0_beta",
|
||||
}.freeze
|
||||
|
||||
GNOME_DEVEL_WHITELIST = {
|
||||
GNOME_DEVEL_ALLOWLIST = {
|
||||
"libart" => "2.3",
|
||||
"gtk-mac-integration" => "2.1",
|
||||
"gtk-doc" => "1.31",
|
||||
@ -646,10 +646,10 @@ module Homebrew
|
||||
|
||||
if formula.head && @versioned_formula
|
||||
head_spec_message = "Formulae should not have a `HEAD` spec"
|
||||
problem head_spec_message unless VERSIONED_HEAD_SPEC_WHITELIST.include?(formula.name)
|
||||
problem head_spec_message unless VERSIONED_HEAD_SPEC_ALLOWLIST.include?(formula.name)
|
||||
end
|
||||
|
||||
THROTTLED_BLACKLIST.each do |f, v|
|
||||
THROTTLED_DENYLIST.each do |f, v|
|
||||
next if formula.stable.nil?
|
||||
|
||||
version = formula.stable.version.to_s.split(".").last.to_i
|
||||
@ -672,12 +672,12 @@ module Homebrew
|
||||
when /[\d._-](alpha|beta|rc\d)/
|
||||
matched = Regexp.last_match(1)
|
||||
version_prefix = stable_version_string.sub(/\d+$/, "")
|
||||
return if UNSTABLE_WHITELIST[formula.name] == version_prefix
|
||||
return if UNSTABLE_ALLOWLIST[formula.name] == version_prefix
|
||||
|
||||
problem "Stable version URLs should not contain #{matched}"
|
||||
when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i
|
||||
version_prefix = stable_version_string.split(".")[0..1].join(".")
|
||||
return if GNOME_DEVEL_WHITELIST[formula.name] == version_prefix
|
||||
return if GNOME_DEVEL_ALLOWLIST[formula.name] == version_prefix
|
||||
return if stable_url_version < Version.create("1.0")
|
||||
return if stable_url_minor_version.even?
|
||||
|
||||
|
||||
@ -101,12 +101,12 @@ module Homebrew
|
||||
fc.update_path
|
||||
end
|
||||
|
||||
# Don't allow blacklisted formula, or names that shadow aliases,
|
||||
# Check for disallowed formula, or names that shadow aliases,
|
||||
# unless --force is specified.
|
||||
unless args.force?
|
||||
if reason = MissingFormula.blacklisted_reason(fc.name)
|
||||
if reason = MissingFormula.disallowed_reason(fc.name)
|
||||
raise <<~EOS
|
||||
#{fc.name} is blacklisted for creation.
|
||||
#{fc.name} is not allowed to be created.
|
||||
#{reason}
|
||||
If you really want to create this formula use --force.
|
||||
EOS
|
||||
|
||||
@ -171,11 +171,11 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
|
||||
def __check_stray_files(dir, pattern, white_list, message)
|
||||
def __check_stray_files(dir, pattern, allow_list, message)
|
||||
return unless File.directory?(dir)
|
||||
|
||||
files = Dir.chdir(dir) do
|
||||
(Dir.glob(pattern) - Dir.glob(white_list))
|
||||
(Dir.glob(pattern) - Dir.glob(allow_list))
|
||||
.select { |f| File.file?(f) && !File.symlink?(f) }
|
||||
.map { |f| File.join(dir, f) }
|
||||
end
|
||||
@ -187,7 +187,7 @@ module Homebrew
|
||||
def check_for_stray_dylibs
|
||||
# Dylibs which are generally OK should be added to this list,
|
||||
# with a short description of the software they come with.
|
||||
white_list = [
|
||||
allow_list = [
|
||||
"libfuse.2.dylib", # MacFuse
|
||||
"libfuse_ino64.2.dylib", # MacFuse
|
||||
"libmacfuse_i32.2.dylib", # OSXFuse MacFuse compatibility layer
|
||||
@ -207,7 +207,7 @@ module Homebrew
|
||||
"sentinel-*.dylib", # SentinelOne
|
||||
]
|
||||
|
||||
__check_stray_files "/usr/local/lib", "*.dylib", white_list, <<~EOS
|
||||
__check_stray_files "/usr/local/lib", "*.dylib", allow_list, <<~EOS
|
||||
Unbrewed dylibs were found in /usr/local/lib.
|
||||
If you didn't put them there on purpose they could cause problems when
|
||||
building Homebrew formulae, and may need to be deleted.
|
||||
@ -219,7 +219,7 @@ module Homebrew
|
||||
def check_for_stray_static_libs
|
||||
# Static libs which are generally OK should be added to this list,
|
||||
# with a short description of the software they come with.
|
||||
white_list = [
|
||||
allow_list = [
|
||||
"libntfs-3g.a", # NTFS-3G
|
||||
"libntfs.a", # NTFS-3G
|
||||
"libublio.a", # NTFS-3G
|
||||
@ -232,7 +232,7 @@ module Homebrew
|
||||
"libtrustedcomponents.a", # Symantec Endpoint Protection
|
||||
]
|
||||
|
||||
__check_stray_files "/usr/local/lib", "*.a", white_list, <<~EOS
|
||||
__check_stray_files "/usr/local/lib", "*.a", allow_list, <<~EOS
|
||||
Unbrewed static libraries were found in /usr/local/lib.
|
||||
If you didn't put them there on purpose they could cause problems when
|
||||
building Homebrew formulae, and may need to be deleted.
|
||||
@ -244,7 +244,7 @@ module Homebrew
|
||||
def check_for_stray_pcs
|
||||
# Package-config files which are generally OK should be added to this list,
|
||||
# with a short description of the software they come with.
|
||||
white_list = [
|
||||
allow_list = [
|
||||
"fuse.pc", # OSXFuse/MacFuse
|
||||
"macfuse.pc", # OSXFuse MacFuse compatibility layer
|
||||
"osxfuse.pc", # OSXFuse
|
||||
@ -252,7 +252,7 @@ module Homebrew
|
||||
"libublio.pc", # NTFS-3G
|
||||
]
|
||||
|
||||
__check_stray_files "/usr/local/lib/pkgconfig", "*.pc", white_list, <<~EOS
|
||||
__check_stray_files "/usr/local/lib/pkgconfig", "*.pc", allow_list, <<~EOS
|
||||
Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
|
||||
If you didn't put them there on purpose they could cause problems when
|
||||
building Homebrew formulae, and may need to be deleted.
|
||||
@ -262,7 +262,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def check_for_stray_las
|
||||
white_list = [
|
||||
allow_list = [
|
||||
"libfuse.la", # MacFuse
|
||||
"libfuse_ino64.la", # MacFuse
|
||||
"libosxfuse_i32.la", # OSXFuse
|
||||
@ -273,7 +273,7 @@ module Homebrew
|
||||
"libublio.la", # NTFS-3G
|
||||
]
|
||||
|
||||
__check_stray_files "/usr/local/lib", "*.la", white_list, <<~EOS
|
||||
__check_stray_files "/usr/local/lib", "*.la", allow_list, <<~EOS
|
||||
Unbrewed .la files were found in /usr/local/lib.
|
||||
If you didn't put them there on purpose they could cause problems when
|
||||
building Homebrew formulae, and may need to be deleted.
|
||||
@ -283,7 +283,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def check_for_stray_headers
|
||||
white_list = [
|
||||
allow_list = [
|
||||
"fuse.h", # MacFuse
|
||||
"fuse/**/*.h", # MacFuse
|
||||
"macfuse/**/*.h", # OSXFuse MacFuse compatibility layer
|
||||
@ -292,7 +292,7 @@ module Homebrew
|
||||
"ntfs-3g/**/*.h", # NTFS-3G
|
||||
]
|
||||
|
||||
__check_stray_files "/usr/local/include", "**/*.h", white_list, <<~EOS
|
||||
__check_stray_files "/usr/local/include", "**/*.h", allow_list, <<~EOS
|
||||
Unbrewed header files were found in /usr/local/include.
|
||||
If you didn't put them there on purpose they could cause problems when
|
||||
building Homebrew formulae, and may need to be deleted.
|
||||
@ -444,7 +444,7 @@ module Homebrew
|
||||
|
||||
scripts = []
|
||||
|
||||
whitelist = %W[
|
||||
allowlist = %W[
|
||||
/bin /sbin
|
||||
/usr/bin /usr/sbin
|
||||
/usr/X11/bin /usr/X11R6/bin /opt/X11/bin
|
||||
@ -454,7 +454,7 @@ module Homebrew
|
||||
].map(&:downcase)
|
||||
|
||||
paths.each do |p|
|
||||
next if whitelist.include?(p.downcase) || !File.directory?(p)
|
||||
next if allowlist.include?(p.downcase) || !File.directory?(p)
|
||||
|
||||
realpath = Pathname.new(p).realpath.to_s
|
||||
next if realpath.start_with?(real_cellar.to_s, HOMEBREW_CELLAR.to_s)
|
||||
|
||||
@ -603,7 +603,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
|
||||
end
|
||||
|
||||
class GitDownloadStrategy < VCSDownloadStrategy
|
||||
SHALLOW_CLONE_WHITELIST = [
|
||||
SHALLOW_CLONE_ALLOWLIST = [
|
||||
%r{git://},
|
||||
%r{https://github\.com},
|
||||
%r{http://git\.sv\.gnu\.org},
|
||||
@ -654,7 +654,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
||||
end
|
||||
|
||||
def support_depth?
|
||||
@ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |regex| @url =~ regex }
|
||||
@ref_type != :revision && SHALLOW_CLONE_ALLOWLIST.any? { |regex| @url =~ regex }
|
||||
end
|
||||
|
||||
def git_dir
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
class LinkageChecker
|
||||
# Libraries provided by glibc and gcc.
|
||||
SYSTEM_LIBRARY_WHITELIST = %w[
|
||||
SYSTEM_LIBRARY_ALLOWLIST = %w[
|
||||
ld-linux-x86-64.so.2
|
||||
libanl.so.1
|
||||
libc.so.6
|
||||
@ -28,7 +28,7 @@ class LinkageChecker
|
||||
# glibc and gcc are implicit dependencies.
|
||||
# No other linkage to system libraries is expected or desired.
|
||||
@unwanted_system_dylibs = @system_dylibs.reject do |s|
|
||||
SYSTEM_LIBRARY_WHITELIST.include? File.basename(s)
|
||||
SYSTEM_LIBRARY_ALLOWLIST.include? File.basename(s)
|
||||
end
|
||||
@undeclared_deps -= ["gcc", "glibc"]
|
||||
end
|
||||
|
||||
@ -8,7 +8,7 @@ require "cask/caskroom"
|
||||
module Homebrew
|
||||
module MissingFormula
|
||||
class << self
|
||||
def blacklisted_reason(name)
|
||||
def disallowed_reason(name)
|
||||
case name.downcase
|
||||
when "xcode"
|
||||
<<~EOS
|
||||
@ -28,7 +28,7 @@ module Homebrew
|
||||
brew cask install basictex
|
||||
EOS
|
||||
else
|
||||
generic_blacklisted_reason(name)
|
||||
generic_disallowed_reason(name)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1088,7 +1088,7 @@ class Formula
|
||||
end
|
||||
|
||||
# Sometimes we accidentally install files outside prefix. After we fix that,
|
||||
# users will get nasty link conflict error. So we create a whitelist here to
|
||||
# users will get nasty link conflict error. So we create an allowlist here to
|
||||
# allow overwriting certain files. e.g.
|
||||
# link_overwrite "bin/foo", "lib/bar"
|
||||
# link_overwrite "share/man/man1/baz-*"
|
||||
@ -1111,7 +1111,7 @@ class Formula
|
||||
begin
|
||||
Formulary.factory(keg.name)
|
||||
rescue FormulaUnavailableError
|
||||
# formula for this keg is deleted, so defer to whitelist
|
||||
# formula for this keg is deleted, so defer to allowlist
|
||||
rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
|
||||
return false # this keg belongs to another formula
|
||||
else
|
||||
@ -2609,12 +2609,12 @@ class Formula
|
||||
# end</pre>
|
||||
#
|
||||
# The block may be omitted, and if present the build may be omitted;
|
||||
# if so, then the compiler will be blacklisted for *all* versions.
|
||||
# if so, then the compiler will not be allowed for *all* versions.
|
||||
#
|
||||
# `major_version` should be the major release number only, for instance
|
||||
# '7' for the GCC 7 series (7.0, 7.1, etc.).
|
||||
# If `version` or the block is omitted, then the compiler will be
|
||||
# blacklisted for all compilers in that series.
|
||||
# If `version` or the block is omitted, then the compiler will
|
||||
# not be allowed for all compilers in that series.
|
||||
#
|
||||
# For example, if a bug is only triggered on GCC 7.1 but is not
|
||||
# encountered on 7.2:
|
||||
|
||||
@ -6,11 +6,11 @@ module Homebrew
|
||||
module MissingFormula
|
||||
class << self
|
||||
def reason(name, silent: false, show_info: false)
|
||||
cask_reason(name, silent: silent, show_info: show_info) || blacklisted_reason(name) ||
|
||||
cask_reason(name, silent: silent, show_info: show_info) || disallowed_reason(name) ||
|
||||
tap_migration_reason(name) || deleted_reason(name, silent: silent)
|
||||
end
|
||||
|
||||
def blacklisted_reason(name)
|
||||
def disallowed_reason(name)
|
||||
case name.downcase
|
||||
when "gem", /^rubygems?$/ then <<~EOS
|
||||
macOS provides gem as part of Ruby. To install a newer version:
|
||||
@ -91,7 +91,7 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
end
|
||||
alias generic_blacklisted_reason blacklisted_reason
|
||||
alias generic_disallowed_reason disallowed_reason
|
||||
|
||||
def tap_migration_reason(name)
|
||||
message = nil
|
||||
|
||||
@ -11,7 +11,7 @@ module RuboCop
|
||||
# where each sub array contains components' details which are at same precedence level
|
||||
class ComponentsOrder < FormulaCop
|
||||
# `aspell`: options and resources should be grouped by language
|
||||
COMPONENT_WHITELIST = %w[
|
||||
COMPONENT_ALLOWLIST = %w[
|
||||
aspell
|
||||
].freeze
|
||||
|
||||
@ -235,7 +235,7 @@ module RuboCop
|
||||
|
||||
# Method to format message for reporting component precedence violations
|
||||
def component_problem(c1, c2)
|
||||
return if COMPONENT_WHITELIST.include?(@formula_name)
|
||||
return if COMPONENT_ALLOWLIST.include?(@formula_name)
|
||||
|
||||
problem "`#{format_component(c1)}` (line #{line_number(c1)}) " \
|
||||
"should be put before `#{format_component(c2)}` " \
|
||||
|
||||
@ -11,14 +11,14 @@ module RuboCop
|
||||
MSG = "Versioned formulae should not use `conflicts_with`. " \
|
||||
"Use `keg_only :versioned_formula` instead."
|
||||
|
||||
WHITELIST = %w[
|
||||
ALLOWLIST = %w[
|
||||
bash-completion@2
|
||||
].freeze
|
||||
|
||||
def audit_formula(_node, _class_node, _parent_class_node, body)
|
||||
return unless versioned_formula?
|
||||
|
||||
problem MSG if !WHITELIST.include?(@formula_name) &&
|
||||
problem MSG if !ALLOWLIST.include?(@formula_name) &&
|
||||
method_called_ever?(body, :conflicts_with)
|
||||
end
|
||||
end
|
||||
|
||||
@ -10,7 +10,7 @@ module RuboCop
|
||||
keg_only_node = find_node_method_by_name(body_node, :keg_only)
|
||||
return unless keg_only_node
|
||||
|
||||
whitelist = %w[
|
||||
allowlist = %w[
|
||||
Apple
|
||||
macOS
|
||||
OS
|
||||
@ -27,7 +27,7 @@ module RuboCop
|
||||
reason = reason.sub(name, "")
|
||||
first_word = reason.split.first
|
||||
|
||||
if reason =~ /\A[A-Z]/ && !reason.start_with?(*whitelist)
|
||||
if reason =~ /\A[A-Z]/ && !reason.start_with?(*allowlist)
|
||||
problem "'#{first_word}' from the keg_only reason should be '#{first_word.downcase}'."
|
||||
end
|
||||
|
||||
|
||||
@ -457,7 +457,7 @@ module RuboCop
|
||||
|
||||
module FormulaAuditStrict
|
||||
class MakeCheck < FormulaCop
|
||||
MAKE_CHECK_WHITELIST = %w[
|
||||
MAKE_CHECK_ALLOWLIST = %w[
|
||||
beecrypt
|
||||
ccrypt
|
||||
git
|
||||
@ -483,7 +483,7 @@ module RuboCop
|
||||
# Avoid build-time checks in homebrew/core
|
||||
find_every_method_call_by_name(body_node, :system).each do |method|
|
||||
next if @formula_name.start_with?("lib")
|
||||
next if MAKE_CHECK_WHITELIST.include?(@formula_name)
|
||||
next if MAKE_CHECK_ALLOWLIST.include?(@formula_name)
|
||||
|
||||
params = parameters(method)
|
||||
next unless node_equals?(params[0], "make")
|
||||
|
||||
@ -8,7 +8,7 @@ module RuboCop
|
||||
# This cop audits URLs and mirrors in Formulae.
|
||||
class Urls < FormulaCop
|
||||
# These are parts of URLs that look like binaries but actually aren't.
|
||||
NOT_A_BINARY_URL_PREFIX_WHITELIST = %w[
|
||||
NOT_A_BINARY_URL_PREFIX_ALLOWLIST = %w[
|
||||
https://downloads.sourceforge.net/project/astyle/astyle/
|
||||
https://downloads.sourceforge.net/project/bittwist/
|
||||
https://downloads.sourceforge.net/project/launch4j/
|
||||
@ -22,7 +22,7 @@ module RuboCop
|
||||
].freeze
|
||||
|
||||
# These are formulae that, sadly, require an upstream binary to bootstrap.
|
||||
BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST = %w[
|
||||
BINARY_BOOTSTRAP_FORMULA_URLS_ALLOWLIST = %w[
|
||||
clozure-cl
|
||||
crystal
|
||||
fpc
|
||||
@ -275,8 +275,8 @@ module RuboCop
|
||||
audit_urls(urls, /(darwin|macos|osx)/i) do |match, url|
|
||||
next if @formula_name.include?(match.to_s.downcase)
|
||||
next if url.match?(/.(patch|diff)(\?full_index=1)?$/)
|
||||
next if NOT_A_BINARY_URL_PREFIX_WHITELIST.any? { |prefix| url.start_with?(prefix) }
|
||||
next if BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST.include?(@formula_name)
|
||||
next if NOT_A_BINARY_URL_PREFIX_ALLOWLIST.any? { |prefix| url.start_with?(prefix) }
|
||||
next if BINARY_BOOTSTRAP_FORMULA_URLS_ALLOWLIST.include?(@formula_name)
|
||||
|
||||
problem "#{url} looks like a binary package, not a source archive; " \
|
||||
"homebrew/core is source-only."
|
||||
|
||||
@ -153,7 +153,7 @@ class Sandbox
|
||||
(regex #"^/dev/fd/[0-9]+$")
|
||||
(regex #"^/dev/tty[a-z0-9]*$")
|
||||
)
|
||||
(deny file-write*) ; deny non-whitelist file write operations
|
||||
(deny file-write*) ; deny non-allowlist file write operations
|
||||
(allow process-exec
|
||||
(literal "/bin/ps")
|
||||
(with no-sandbox)
|
||||
|
||||
@ -399,18 +399,18 @@ describe Cask::Audit, :cask do
|
||||
end
|
||||
end
|
||||
|
||||
describe "blacklist checks" do
|
||||
context "when the Cask isn't blacklisted" do
|
||||
describe "denylist checks" do
|
||||
context "when the Cask isn't disallowed" do
|
||||
let(:cask_token) { "adobe-air" }
|
||||
|
||||
it { is_expected.to pass }
|
||||
end
|
||||
|
||||
context "when the Cask is blacklisted" do
|
||||
context "when the Cask is disallowed" do
|
||||
context "and it's in the official Homebrew tap" do
|
||||
let(:cask_token) { "adobe-illustrator" }
|
||||
|
||||
it { is_expected.to fail_with(/#{cask_token} is blacklisted: \w+/) }
|
||||
it { is_expected.to fail_with(/#{cask_token} is not allowed: \w+/) }
|
||||
end
|
||||
|
||||
context "and it isn't in the official Homebrew tap" do
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Cask::Blacklist, :cask do
|
||||
describe "::blacklisted_reason" do
|
||||
matcher :blacklist do |name|
|
||||
match do |expected|
|
||||
expected.blacklisted_reason(name)
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.not_to blacklist("adobe-air") }
|
||||
it { is_expected.to blacklist("adobe-after-effects") }
|
||||
it { is_expected.to blacklist("adobe-illustrator") }
|
||||
it { is_expected.to blacklist("adobe-indesign") }
|
||||
it { is_expected.to blacklist("adobe-photoshop") }
|
||||
it { is_expected.to blacklist("adobe-premiere") }
|
||||
it { is_expected.to blacklist("audacity") }
|
||||
it { is_expected.to blacklist("pharo") }
|
||||
it { is_expected.not_to blacklist("non-blacklisted-cask") }
|
||||
end
|
||||
end
|
||||
21
Library/Homebrew/test/cask/denylist_spec.rb
Normal file
21
Library/Homebrew/test/cask/denylist_spec.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Cask::Denylist, :cask do
|
||||
describe "::reason" do
|
||||
matcher :disallow do |name|
|
||||
match do |expected|
|
||||
expected.reason(name)
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.not_to disallow("adobe-air") }
|
||||
it { is_expected.to disallow("adobe-after-effects") }
|
||||
it { is_expected.to disallow("adobe-illustrator") }
|
||||
it { is_expected.to disallow("adobe-indesign") }
|
||||
it { is_expected.to disallow("adobe-photoshop") }
|
||||
it { is_expected.to disallow("adobe-premiere") }
|
||||
it { is_expected.to disallow("audacity") }
|
||||
it { is_expected.to disallow("pharo") }
|
||||
it { is_expected.not_to disallow("allowed-cask") }
|
||||
end
|
||||
end
|
||||
@ -234,7 +234,7 @@ module Homebrew
|
||||
|
||||
describe "#audit_deps" do
|
||||
describe "a dependency on a macOS-provided keg-only formula" do
|
||||
describe "which is whitelisted" do
|
||||
describe "which is allowlisted" do
|
||||
subject { fa }
|
||||
|
||||
let(:fa) do
|
||||
@ -266,7 +266,7 @@ module Homebrew
|
||||
its(:problems) { are_expected.to be_empty }
|
||||
end
|
||||
|
||||
describe "which is not whitelisted", :needs_macos do
|
||||
describe "which is not allowlisted", :needs_macos do
|
||||
subject { fa }
|
||||
|
||||
let(:fa) do
|
||||
@ -518,11 +518,11 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_WHITELIST
|
||||
include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_WHITELIST
|
||||
include_examples "formulae exist", described_class::USES_FROM_MACOS_WHITELIST
|
||||
include_examples "formulae exist", described_class::THROTTLED_BLACKLIST.keys
|
||||
include_examples "formulae exist", described_class::UNSTABLE_WHITELIST.keys
|
||||
include_examples "formulae exist", described_class::GNOME_DEVEL_WHITELIST.keys
|
||||
include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_ALLOWLIST
|
||||
include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_ALLOWLIST
|
||||
include_examples "formulae exist", described_class::USES_FROM_MACOS_ALLOWLIST
|
||||
include_examples "formulae exist", described_class::THROTTLED_DENYLIST.keys
|
||||
include_examples "formulae exist", described_class::UNSTABLE_ALLOWLIST.keys
|
||||
include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys
|
||||
end
|
||||
end
|
||||
|
||||
@ -9,29 +9,29 @@ describe Homebrew::MissingFormula do
|
||||
it { is_expected.not_to be_nil }
|
||||
end
|
||||
|
||||
describe "::blacklisted_reason" do
|
||||
matcher :blacklist do |name|
|
||||
describe "::disallowed_reason" do
|
||||
matcher :disallow do |name|
|
||||
match do |expected|
|
||||
expected.blacklisted_reason(name)
|
||||
expected.disallowed_reason(name)
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.to blacklist("gem") }
|
||||
it("blacklists LaTeX", :needs_macos) { is_expected.to blacklist("latex") }
|
||||
it { is_expected.to blacklist("pip") }
|
||||
it { is_expected.to blacklist("pil") }
|
||||
it { is_expected.to blacklist("macruby") }
|
||||
it { is_expected.to blacklist("lzma") }
|
||||
it { is_expected.to blacklist("gtest") }
|
||||
it { is_expected.to blacklist("gmock") }
|
||||
it { is_expected.to blacklist("sshpass") }
|
||||
it { is_expected.to blacklist("gsutil") }
|
||||
it { is_expected.to blacklist("gfortran") }
|
||||
it { is_expected.to blacklist("play") }
|
||||
it { is_expected.to blacklist("haskell-platform") }
|
||||
it { is_expected.to blacklist("mysqldump-secure") }
|
||||
it { is_expected.to blacklist("ngrok") }
|
||||
it("blacklists Xcode", :needs_macos) { is_expected.to blacklist("xcode") }
|
||||
it { is_expected.to disallow("gem") }
|
||||
it("disallows LaTeX", :needs_macos) { is_expected.to disallow("latex") }
|
||||
it { is_expected.to disallow("pip") }
|
||||
it { is_expected.to disallow("pil") }
|
||||
it { is_expected.to disallow("macruby") }
|
||||
it { is_expected.to disallow("lzma") }
|
||||
it { is_expected.to disallow("gtest") }
|
||||
it { is_expected.to disallow("gmock") }
|
||||
it { is_expected.to disallow("sshpass") }
|
||||
it { is_expected.to disallow("gsutil") }
|
||||
it { is_expected.to disallow("gfortran") }
|
||||
it { is_expected.to disallow("play") }
|
||||
it { is_expected.to disallow("haskell-platform") }
|
||||
it { is_expected.to disallow("mysqldump-secure") }
|
||||
it { is_expected.to disallow("ngrok") }
|
||||
it("disallows Xcode", :needs_macos) { is_expected.to disallow("xcode") }
|
||||
end
|
||||
|
||||
describe "::tap_migration_reason" do
|
||||
|
||||
@ -477,6 +477,6 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
|
||||
RUBY
|
||||
end
|
||||
|
||||
include_examples "formulae exist", described_class::COMPONENT_WHITELIST
|
||||
include_examples "formulae exist", described_class::COMPONENT_ALLOWLIST
|
||||
end
|
||||
end
|
||||
|
||||
@ -27,5 +27,5 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do
|
||||
end
|
||||
end
|
||||
|
||||
include_examples "formulae exist", described_class::WHITELIST
|
||||
include_examples "formulae exist", described_class::ALLOWLIST
|
||||
end
|
||||
|
||||
@ -46,7 +46,7 @@ describe RuboCop::Cop::FormulaAudit::KegOnly do
|
||||
RUBY
|
||||
end
|
||||
|
||||
specify "keg_only_handles_whitelist_correctly" do
|
||||
specify "keg_only_handles_allowlist_correctly" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
@ -865,5 +865,5 @@ describe RuboCop::Cop::FormulaAuditStrict::MakeCheck do
|
||||
RUBY
|
||||
end
|
||||
|
||||
include_examples "formulae exist", described_class::MAKE_CHECK_WHITELIST
|
||||
include_examples "formulae exist", described_class::MAKE_CHECK_ALLOWLIST
|
||||
end
|
||||
|
||||
@ -239,7 +239,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do
|
||||
end
|
||||
end
|
||||
|
||||
include_examples "formulae exist", described_class::BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST
|
||||
include_examples "formulae exist", described_class::BINARY_BOOTSTRAP_FORMULA_URLS_ALLOWLIST
|
||||
end
|
||||
|
||||
describe RuboCop::Cop::FormulaAudit::PyPiUrls do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user