Change occurrences of "whitelist" to "allowlist"

This commit is contained in:
Issy Long 2020-06-06 19:12:12 +01:00
parent aff92b3af3
commit 0041ea21f5
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4
18 changed files with 56 additions and 56 deletions

View File

@ -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:

View File

@ -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,7 +552,7 @@ module Homebrew
[user, repo]
end
VERSIONED_HEAD_SPEC_WHITELIST = %w[
VERSIONED_HEAD_SPEC_ALLOWLIST = %w[
bash-completion@2
imagemagick@6
].freeze
@ -564,7 +564,7 @@ module Homebrew
"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,7 +646,7 @@ 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|
@ -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?

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)}` " \

View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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."

View File

@ -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)

View File

@ -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::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_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::UNSTABLE_ALLOWLIST.keys
include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys
end
end

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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