Commit 09858619 authored by Ayu Ishii's avatar Ayu Ishii Committed by LUCI CQ

CodeInclusion: Rename whitelist/blacklist -> allowlist/blocklist

Migrate to more inclusive terminology.

Bug: 1097674
Change-Id: I387b385ff36c7766682c06af34ed5fc6115119d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2268403Reviewed-by: 's avatarAnthony Polito <apolito@google.com>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
parent 37ce201d
......@@ -3748,8 +3748,8 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
# Block bodies should not be followed by a semicolon. Due to C++11
# brace initialization, there are more places where semicolons are
# required than not, so we use a whitelist approach to check these
# rather than a blacklist. These are the places where "};" should
# required than not, so we use an allowlist approach to check these
# rather than a blocklist. These are the places where "};" should
# be replaced by just "}":
# 1. Some flavor of block following closing parenthesis:
# for (;;) {};
......@@ -3806,11 +3806,11 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
# - INTERFACE_DEF
# - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED:
#
# We implement a whitelist of safe macros instead of a blacklist of
# We implement an allowlist of safe macros instead of a blocklist of
# unsafe macros, even though the latter appears less frequently in
# google code and would have been easier to implement. This is because
# the downside for getting the whitelist wrong means some extra
# semicolons, while the downside for getting the blacklist wrong
# google code and would have been easier to implement. This is because
# the downside for getting the allowlist wrong means some extra
# semicolons, while the downside for getting the blocklist wrong
# would result in compile errors.
#
# In addition to macros, we also don't want to warn on
......@@ -4991,19 +4991,19 @@ def CheckForNonConstReference(filename, clean_lines, linenum,
#
# We also accept & in static_assert, which looks like a function but
# it's actually a declaration expression.
whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
allowlisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
r'operator\s*[<>][<>]|'
r'static_assert|COMPILE_ASSERT'
r')\s*\(')
if Search(whitelisted_functions, line):
if Search(allowlisted_functions, line):
return
elif not Search(r'\S+\([^)]*$', line):
# Don't see a whitelisted function on this line. Actually we
# Don't see an allowlisted function on this line. Actually we
# didn't see any function name on this line, so this is likely a
# multi-line parameter list. Try a bit harder to catch this case.
for i in range(2):
if (linenum > i and
Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
Search(allowlisted_functions, clean_lines.elided[linenum - i - 1])):
return
decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body
......
......@@ -135,7 +135,7 @@ _GCLIENT_HOOKS_SCHEMA = [
_GCLIENT_SCHEMA = schema.Schema(
_NodeDictSchema({
# List of host names from which dependencies are allowed (whitelist).
# List of host names from which dependencies are allowed (allowlist).
# NOTE: when not present, all hosts are allowed.
# NOTE: scoped to current DEPS file, not recursive.
schema.Optional('allowed_hosts'): [schema.Optional(basestring)],
......@@ -187,7 +187,7 @@ _GCLIENT_SCHEMA = schema.Schema(
# Recursion limit for nested DEPS.
schema.Optional('recursion'): int,
# Whitelists deps for which recursion should be enabled.
# Allowlists deps for which recursion should be enabled.
schema.Optional('recursedeps'): [
schema.Optional(schema.Or(
basestring,
......@@ -196,7 +196,7 @@ _GCLIENT_SCHEMA = schema.Schema(
)),
],
# Blacklists directories for checking 'include_rules'.
# Blocklists directories for checking 'include_rules'.
schema.Optional('skip_child_includes'): [schema.Optional(basestring)],
# Mapping from paths to include rules specific for that path.
......
......@@ -49,7 +49,7 @@ _WARNINGS = []
# These repos are known to cause OOM errors on 32-bit platforms, due the the
# very large objects they contain. It is not safe to use threaded index-pack
# when cloning/fetching them.
THREADED_INDEX_PACK_BLACKLIST = [
THREADED_INDEX_PACK_BLOCKLIST = [
'https://chromium.googlesource.com/chromium/reference_builds/chrome_win.git'
]
......@@ -1193,7 +1193,7 @@ def DefaultIndexPackConfig(url=''):
performance."""
cache_limit = DefaultDeltaBaseCacheLimit()
result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
if url in THREADED_INDEX_PACK_BLACKLIST:
if url in THREADED_INDEX_PACK_BLOCKLIST:
result.extend(['-c', 'pack.threads=1'])
return result
......
......@@ -17,7 +17,7 @@ import git_common as git
FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): *(.*)$')
CHROME_COMMIT_POSITION_PATTERN = re.compile(r'^([\w/\-\.]+)@{#(\d+)}$')
FOOTER_KEY_BLACKLIST = set(['http', 'https'])
FOOTER_KEY_BLOCKLIST = set(['http', 'https'])
def normalize_name(header):
......@@ -27,7 +27,7 @@ def normalize_name(header):
def parse_footer(line):
"""Returns footer's (key, value) if footer is valid, else None."""
match = FOOTER_PATTERN.match(line)
if match and match.group(1) not in FOOTER_KEY_BLACKLIST:
if match and match.group(1) not in FOOTER_KEY_BLOCKLIST:
return (match.group(1), match.group(2))
return None
......
......@@ -7,7 +7,7 @@
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not
# Add files or directories to the blocklist. They should be base names, not
# paths.
ignore=CVS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment