From 0041ea21f57c8abf4a543d8645ec25e1704542a6 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 6 Jun 2020 19:12:12 +0100 Subject: [PATCH 1/2] Change occurrences of "whitelist" to "allowlist" --- Library/Homebrew/.rubocop.yml | 2 +- Library/Homebrew/dev-cmd/audit.rb | 20 ++++++------- Library/Homebrew/diagnostic.rb | 28 +++++++++---------- Library/Homebrew/download_strategy.rb | 4 +-- .../extend/os/linux/linkage_checker.rb | 4 +-- Library/Homebrew/formula.rb | 4 +-- Library/Homebrew/rubocops/components_order.rb | 4 +-- Library/Homebrew/rubocops/conflicts.rb | 4 +-- Library/Homebrew/rubocops/keg_only.rb | 4 +-- Library/Homebrew/rubocops/lines.rb | 4 +-- Library/Homebrew/rubocops/urls.rb | 8 +++--- Library/Homebrew/sandbox.rb | 2 +- Library/Homebrew/test/dev-cmd/audit_spec.rb | 14 +++++----- .../test/rubocops/components_order_spec.rb | 2 +- .../Homebrew/test/rubocops/conflicts_spec.rb | 2 +- .../Homebrew/test/rubocops/keg_only_spec.rb | 2 +- Library/Homebrew/test/rubocops/lines_spec.rb | 2 +- Library/Homebrew/test/rubocops/urls_spec.rb | 2 +- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index bdb40a9b91..958fb53548 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -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: diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index da19542935..9c893c36a3 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -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? diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index ae7bb34fa9..e12449f359 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -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) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index e98b300828..bb6b6f1f03 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -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 diff --git a/Library/Homebrew/extend/os/linux/linkage_checker.rb b/Library/Homebrew/extend/os/linux/linkage_checker.rb index a3e3387363..30e073513c 100644 --- a/Library/Homebrew/extend/os/linux/linkage_checker.rb +++ b/Library/Homebrew/extend/os/linux/linkage_checker.rb @@ -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 diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1c027380f1..2a09f4dfb3 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -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 diff --git a/Library/Homebrew/rubocops/components_order.rb b/Library/Homebrew/rubocops/components_order.rb index 155bd18e72..04eaaea646 100644 --- a/Library/Homebrew/rubocops/components_order.rb +++ b/Library/Homebrew/rubocops/components_order.rb @@ -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)}` " \ diff --git a/Library/Homebrew/rubocops/conflicts.rb b/Library/Homebrew/rubocops/conflicts.rb index d9be5ac7ec..08c1f37ffa 100644 --- a/Library/Homebrew/rubocops/conflicts.rb +++ b/Library/Homebrew/rubocops/conflicts.rb @@ -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 diff --git a/Library/Homebrew/rubocops/keg_only.rb b/Library/Homebrew/rubocops/keg_only.rb index e2969f2df1..0c3d76ff63 100644 --- a/Library/Homebrew/rubocops/keg_only.rb +++ b/Library/Homebrew/rubocops/keg_only.rb @@ -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 diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 7de4690695..86b25ecebf 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -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") diff --git a/Library/Homebrew/rubocops/urls.rb b/Library/Homebrew/rubocops/urls.rb index f0872b3c1f..d83bfd113b 100644 --- a/Library/Homebrew/rubocops/urls.rb +++ b/Library/Homebrew/rubocops/urls.rb @@ -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." diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index cef9816ebc..6da3dc18c2 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -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) diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 132d70bf40..42ce39e692 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -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 diff --git a/Library/Homebrew/test/rubocops/components_order_spec.rb b/Library/Homebrew/test/rubocops/components_order_spec.rb index 53e04e01bf..a48b56601a 100644 --- a/Library/Homebrew/test/rubocops/components_order_spec.rb +++ b/Library/Homebrew/test/rubocops/components_order_spec.rb @@ -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 diff --git a/Library/Homebrew/test/rubocops/conflicts_spec.rb b/Library/Homebrew/test/rubocops/conflicts_spec.rb index 43fe3b5124..58524603f8 100644 --- a/Library/Homebrew/test/rubocops/conflicts_spec.rb +++ b/Library/Homebrew/test/rubocops/conflicts_spec.rb @@ -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 diff --git a/Library/Homebrew/test/rubocops/keg_only_spec.rb b/Library/Homebrew/test/rubocops/keg_only_spec.rb index 81112da206..dd01dbb327 100644 --- a/Library/Homebrew/test/rubocops/keg_only_spec.rb +++ b/Library/Homebrew/test/rubocops/keg_only_spec.rb @@ -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" diff --git a/Library/Homebrew/test/rubocops/lines_spec.rb b/Library/Homebrew/test/rubocops/lines_spec.rb index e3ee5e0e92..19545be896 100644 --- a/Library/Homebrew/test/rubocops/lines_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_spec.rb @@ -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 diff --git a/Library/Homebrew/test/rubocops/urls_spec.rb b/Library/Homebrew/test/rubocops/urls_spec.rb index 24c33cf60a..c5efb9335b 100644 --- a/Library/Homebrew/test/rubocops/urls_spec.rb +++ b/Library/Homebrew/test/rubocops/urls_spec.rb @@ -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 From 8eba9b86ab6b56dcf84b14155cce257c10e0accd Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 6 Jun 2020 21:10:16 +0100 Subject: [PATCH 2/2] Change occurrences of "blacklist" to "denylist" or "disallow" - Depending on context, I've gone for either "denylist" or "disallow" here. "Disallow" for things in sentences, or actions, and "denylist" for list of things. --- Library/Homebrew/cask/audit.rb | 10 ++--- .../cask/{blacklist.rb => denylist.rb} | 4 +- Library/Homebrew/dev-cmd/audit.rb | 6 +-- Library/Homebrew/dev-cmd/create.rb | 6 +-- .../Homebrew/extend/os/mac/missing_formula.rb | 4 +- Library/Homebrew/formula.rb | 6 +-- Library/Homebrew/missing_formula.rb | 6 +-- Library/Homebrew/test/cask/audit_spec.rb | 8 ++-- Library/Homebrew/test/cask/blacklist_spec.rb | 21 ---------- Library/Homebrew/test/cask/denylist_spec.rb | 21 ++++++++++ Library/Homebrew/test/dev-cmd/audit_spec.rb | 2 +- Library/Homebrew/test/missing_formula_spec.rb | 38 +++++++++---------- 12 files changed, 66 insertions(+), 66 deletions(-) rename Library/Homebrew/cask/{blacklist.rb => denylist.rb} (88%) delete mode 100644 Library/Homebrew/test/cask/blacklist_spec.rb create mode 100644 Library/Homebrew/test/cask/denylist_spec.rb diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 2b3429f5dd..441509bc38 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -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 diff --git a/Library/Homebrew/cask/blacklist.rb b/Library/Homebrew/cask/denylist.rb similarity index 88% rename from Library/Homebrew/cask/blacklist.rb rename to Library/Homebrew/cask/denylist.rb index 810067a39e..86bd1151ae 100644 --- a/Library/Homebrew/cask/blacklist.rb +++ b/Library/Homebrew/cask/denylist.rb @@ -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." diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 9c893c36a3..f4001c45f9 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -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." @@ -557,7 +557,7 @@ module Homebrew imagemagick@6 ].freeze - THROTTLED_BLACKLIST = { + THROTTLED_DENYLIST = { "aws-sdk-cpp" => "10", "awscli@1" => "10", "quicktype" => "10", @@ -649,7 +649,7 @@ module Homebrew 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 diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 10d5f5df85..3fe90865c6 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -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 diff --git a/Library/Homebrew/extend/os/mac/missing_formula.rb b/Library/Homebrew/extend/os/mac/missing_formula.rb index 37fe2d228b..cceda91550 100644 --- a/Library/Homebrew/extend/os/mac/missing_formula.rb +++ b/Library/Homebrew/extend/os/mac/missing_formula.rb @@ -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 diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 2a09f4dfb3..00a581b745 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2609,12 +2609,12 @@ class Formula # end # # 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: diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 70ec26b1dd..43e2fdf7b3 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -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 diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 4533bf825c..af80c6d749 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cask/blacklist_spec.rb b/Library/Homebrew/test/cask/blacklist_spec.rb deleted file mode 100644 index 3213b5a805..0000000000 --- a/Library/Homebrew/test/cask/blacklist_spec.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/test/cask/denylist_spec.rb b/Library/Homebrew/test/cask/denylist_spec.rb new file mode 100644 index 0000000000..79cae362a4 --- /dev/null +++ b/Library/Homebrew/test/cask/denylist_spec.rb @@ -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 diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 42ce39e692..c323403a4f 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -521,7 +521,7 @@ module Homebrew 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::THROTTLED_DENYLIST.keys include_examples "formulae exist", described_class::UNSTABLE_ALLOWLIST.keys include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys end diff --git a/Library/Homebrew/test/missing_formula_spec.rb b/Library/Homebrew/test/missing_formula_spec.rb index 3e807c475b..4d88dfedca 100644 --- a/Library/Homebrew/test/missing_formula_spec.rb +++ b/Library/Homebrew/test/missing_formula_spec.rb @@ -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