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.
This commit is contained in:
Issy Long 2020-06-06 21:10:16 +01:00
parent 0041ea21f5
commit 8eba9b86ab
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4
12 changed files with 66 additions and 66 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View 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

View File

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

View File

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