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:
parent
0041ea21f5
commit
8eba9b86ab
@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cask/blacklist"
|
require "cask/denylist"
|
||||||
require "cask/checkable"
|
require "cask/checkable"
|
||||||
require "cask/download"
|
require "cask/download"
|
||||||
require "digest"
|
require "digest"
|
||||||
@ -32,7 +32,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run!
|
def run!
|
||||||
check_blacklist
|
check_denylist
|
||||||
check_required_stanzas
|
check_required_stanzas
|
||||||
check_version
|
check_version
|
||||||
check_sha256
|
check_sha256
|
||||||
@ -370,11 +370,11 @@ module Cask
|
|||||||
[user, repo]
|
[user, repo]
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_blacklist
|
def check_denylist
|
||||||
return if cask.tap&.user != "Homebrew"
|
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
|
end
|
||||||
|
|
||||||
def check_https_availability
|
def check_https_availability
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Blacklist
|
module Denylist
|
||||||
def self.blacklisted_reason(name)
|
def self.reason(name)
|
||||||
case name
|
case name
|
||||||
when /^adobe-(after|illustrator|indesign|photoshop|premiere)/
|
when /^adobe-(after|illustrator|indesign|photoshop|premiere)/
|
||||||
"Adobe casks were removed because they are too difficult to maintain."
|
"Adobe casks were removed because they are too difficult to maintain."
|
@ -309,7 +309,7 @@ module Homebrew
|
|||||||
|
|
||||||
name = formula.name
|
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
|
if Formula.aliases.include? name
|
||||||
problem "Formula name conflicts with existing aliases in homebrew/core."
|
problem "Formula name conflicts with existing aliases in homebrew/core."
|
||||||
@ -557,7 +557,7 @@ module Homebrew
|
|||||||
imagemagick@6
|
imagemagick@6
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
THROTTLED_BLACKLIST = {
|
THROTTLED_DENYLIST = {
|
||||||
"aws-sdk-cpp" => "10",
|
"aws-sdk-cpp" => "10",
|
||||||
"awscli@1" => "10",
|
"awscli@1" => "10",
|
||||||
"quicktype" => "10",
|
"quicktype" => "10",
|
||||||
@ -649,7 +649,7 @@ module Homebrew
|
|||||||
problem head_spec_message unless VERSIONED_HEAD_SPEC_ALLOWLIST.include?(formula.name)
|
problem head_spec_message unless VERSIONED_HEAD_SPEC_ALLOWLIST.include?(formula.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
THROTTLED_BLACKLIST.each do |f, v|
|
THROTTLED_DENYLIST.each do |f, v|
|
||||||
next if formula.stable.nil?
|
next if formula.stable.nil?
|
||||||
|
|
||||||
version = formula.stable.version.to_s.split(".").last.to_i
|
version = formula.stable.version.to_s.split(".").last.to_i
|
||||||
|
@ -101,12 +101,12 @@ module Homebrew
|
|||||||
fc.update_path
|
fc.update_path
|
||||||
end
|
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 --force is specified.
|
||||||
unless args.force?
|
unless args.force?
|
||||||
if reason = MissingFormula.blacklisted_reason(fc.name)
|
if reason = MissingFormula.disallowed_reason(fc.name)
|
||||||
raise <<~EOS
|
raise <<~EOS
|
||||||
#{fc.name} is blacklisted for creation.
|
#{fc.name} is not allowed to be created.
|
||||||
#{reason}
|
#{reason}
|
||||||
If you really want to create this formula use --force.
|
If you really want to create this formula use --force.
|
||||||
EOS
|
EOS
|
||||||
|
@ -8,7 +8,7 @@ require "cask/caskroom"
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module MissingFormula
|
module MissingFormula
|
||||||
class << self
|
class << self
|
||||||
def blacklisted_reason(name)
|
def disallowed_reason(name)
|
||||||
case name.downcase
|
case name.downcase
|
||||||
when "xcode"
|
when "xcode"
|
||||||
<<~EOS
|
<<~EOS
|
||||||
@ -28,7 +28,7 @@ module Homebrew
|
|||||||
brew cask install basictex
|
brew cask install basictex
|
||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
generic_blacklisted_reason(name)
|
generic_disallowed_reason(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2609,12 +2609,12 @@ class Formula
|
|||||||
# end</pre>
|
# end</pre>
|
||||||
#
|
#
|
||||||
# The block may be omitted, and if present the build may be omitted;
|
# 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
|
# `major_version` should be the major release number only, for instance
|
||||||
# '7' for the GCC 7 series (7.0, 7.1, etc.).
|
# '7' for the GCC 7 series (7.0, 7.1, etc.).
|
||||||
# If `version` or the block is omitted, then the compiler will be
|
# If `version` or the block is omitted, then the compiler will
|
||||||
# blacklisted for all compilers in that series.
|
# not be allowed for all compilers in that series.
|
||||||
#
|
#
|
||||||
# For example, if a bug is only triggered on GCC 7.1 but is not
|
# For example, if a bug is only triggered on GCC 7.1 but is not
|
||||||
# encountered on 7.2:
|
# encountered on 7.2:
|
||||||
|
@ -6,11 +6,11 @@ module Homebrew
|
|||||||
module MissingFormula
|
module MissingFormula
|
||||||
class << self
|
class << self
|
||||||
def reason(name, silent: false, show_info: false)
|
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)
|
tap_migration_reason(name) || deleted_reason(name, silent: silent)
|
||||||
end
|
end
|
||||||
|
|
||||||
def blacklisted_reason(name)
|
def disallowed_reason(name)
|
||||||
case name.downcase
|
case name.downcase
|
||||||
when "gem", /^rubygems?$/ then <<~EOS
|
when "gem", /^rubygems?$/ then <<~EOS
|
||||||
macOS provides gem as part of Ruby. To install a newer version:
|
macOS provides gem as part of Ruby. To install a newer version:
|
||||||
@ -91,7 +91,7 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias generic_blacklisted_reason blacklisted_reason
|
alias generic_disallowed_reason disallowed_reason
|
||||||
|
|
||||||
def tap_migration_reason(name)
|
def tap_migration_reason(name)
|
||||||
message = nil
|
message = nil
|
||||||
|
@ -399,18 +399,18 @@ describe Cask::Audit, :cask do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "blacklist checks" do
|
describe "denylist checks" do
|
||||||
context "when the Cask isn't blacklisted" do
|
context "when the Cask isn't disallowed" do
|
||||||
let(:cask_token) { "adobe-air" }
|
let(:cask_token) { "adobe-air" }
|
||||||
|
|
||||||
it { is_expected.to pass }
|
it { is_expected.to pass }
|
||||||
end
|
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
|
context "and it's in the official Homebrew tap" do
|
||||||
let(:cask_token) { "adobe-illustrator" }
|
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
|
end
|
||||||
|
|
||||||
context "and it isn't in the official Homebrew tap" do
|
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
|
@ -521,7 +521,7 @@ module Homebrew
|
|||||||
include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_ALLOWLIST
|
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::VERSIONED_HEAD_SPEC_ALLOWLIST
|
||||||
include_examples "formulae exist", described_class::USES_FROM_MACOS_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::UNSTABLE_ALLOWLIST.keys
|
||||||
include_examples "formulae exist", described_class::GNOME_DEVEL_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 }
|
it { is_expected.not_to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "::blacklisted_reason" do
|
describe "::disallowed_reason" do
|
||||||
matcher :blacklist do |name|
|
matcher :disallow do |name|
|
||||||
match do |expected|
|
match do |expected|
|
||||||
expected.blacklisted_reason(name)
|
expected.disallowed_reason(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to blacklist("gem") }
|
it { is_expected.to disallow("gem") }
|
||||||
it("blacklists LaTeX", :needs_macos) { is_expected.to blacklist("latex") }
|
it("disallows LaTeX", :needs_macos) { is_expected.to disallow("latex") }
|
||||||
it { is_expected.to blacklist("pip") }
|
it { is_expected.to disallow("pip") }
|
||||||
it { is_expected.to blacklist("pil") }
|
it { is_expected.to disallow("pil") }
|
||||||
it { is_expected.to blacklist("macruby") }
|
it { is_expected.to disallow("macruby") }
|
||||||
it { is_expected.to blacklist("lzma") }
|
it { is_expected.to disallow("lzma") }
|
||||||
it { is_expected.to blacklist("gtest") }
|
it { is_expected.to disallow("gtest") }
|
||||||
it { is_expected.to blacklist("gmock") }
|
it { is_expected.to disallow("gmock") }
|
||||||
it { is_expected.to blacklist("sshpass") }
|
it { is_expected.to disallow("sshpass") }
|
||||||
it { is_expected.to blacklist("gsutil") }
|
it { is_expected.to disallow("gsutil") }
|
||||||
it { is_expected.to blacklist("gfortran") }
|
it { is_expected.to disallow("gfortran") }
|
||||||
it { is_expected.to blacklist("play") }
|
it { is_expected.to disallow("play") }
|
||||||
it { is_expected.to blacklist("haskell-platform") }
|
it { is_expected.to disallow("haskell-platform") }
|
||||||
it { is_expected.to blacklist("mysqldump-secure") }
|
it { is_expected.to disallow("mysqldump-secure") }
|
||||||
it { is_expected.to blacklist("ngrok") }
|
it { is_expected.to disallow("ngrok") }
|
||||||
it("blacklists Xcode", :needs_macos) { is_expected.to blacklist("xcode") }
|
it("disallows Xcode", :needs_macos) { is_expected.to disallow("xcode") }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "::tap_migration_reason" do
|
describe "::tap_migration_reason" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user