From 8eba9b86ab6b56dcf84b14155cce257c10e0accd Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 6 Jun 2020 21:10:16 +0100 Subject: [PATCH] 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