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/+/2268403
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
changes/03/2268403/4
Ayu Ishii 5 years ago committed by LUCI CQ
parent 37ce201d92
commit 0985861970

18
cpplint.py vendored

@ -3748,8 +3748,8 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
# Block bodies should not be followed by a semicolon. Due to C++11 # Block bodies should not be followed by a semicolon. Due to C++11
# brace initialization, there are more places where semicolons are # brace initialization, there are more places where semicolons are
# required than not, so we use a whitelist approach to check these # required than not, so we use an allowlist approach to check these
# rather than a blacklist. These are the places where "};" should # rather than a blocklist. These are the places where "};" should
# be replaced by just "}": # be replaced by just "}":
# 1. Some flavor of block following closing parenthesis: # 1. Some flavor of block following closing parenthesis:
# for (;;) {}; # for (;;) {};
@ -3806,11 +3806,11 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
# - INTERFACE_DEF # - INTERFACE_DEF
# - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED: # - 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 # unsafe macros, even though the latter appears less frequently in
# google code and would have been easier to implement. This is because # google code and would have been easier to implement. This is because
# the downside for getting the whitelist wrong means some extra # the downside for getting the allowlist wrong means some extra
# semicolons, while the downside for getting the blacklist wrong # semicolons, while the downside for getting the blocklist wrong
# would result in compile errors. # would result in compile errors.
# #
# In addition to macros, we also don't want to warn on # 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 # We also accept & in static_assert, which looks like a function but
# it's actually a declaration expression. # it's actually a declaration expression.
whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|' allowlisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
r'operator\s*[<>][<>]|' r'operator\s*[<>][<>]|'
r'static_assert|COMPILE_ASSERT' r'static_assert|COMPILE_ASSERT'
r')\s*\(') r')\s*\(')
if Search(whitelisted_functions, line): if Search(allowlisted_functions, line):
return return
elif not Search(r'\S+\([^)]*$', line): 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 # 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. # multi-line parameter list. Try a bit harder to catch this case.
for i in range(2): for i in range(2):
if (linenum > i and if (linenum > i and
Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])): Search(allowlisted_functions, clean_lines.elided[linenum - i - 1])):
return return
decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body

@ -135,7 +135,7 @@ _GCLIENT_HOOKS_SCHEMA = [
_GCLIENT_SCHEMA = schema.Schema( _GCLIENT_SCHEMA = schema.Schema(
_NodeDictSchema({ _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: when not present, all hosts are allowed.
# NOTE: scoped to current DEPS file, not recursive. # NOTE: scoped to current DEPS file, not recursive.
schema.Optional('allowed_hosts'): [schema.Optional(basestring)], schema.Optional('allowed_hosts'): [schema.Optional(basestring)],
@ -187,7 +187,7 @@ _GCLIENT_SCHEMA = schema.Schema(
# Recursion limit for nested DEPS. # Recursion limit for nested DEPS.
schema.Optional('recursion'): int, 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('recursedeps'): [
schema.Optional(schema.Or( schema.Optional(schema.Or(
basestring, 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)], schema.Optional('skip_child_includes'): [schema.Optional(basestring)],
# Mapping from paths to include rules specific for that path. # 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 # 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 # very large objects they contain. It is not safe to use threaded index-pack
# when cloning/fetching them. # when cloning/fetching them.
THREADED_INDEX_PACK_BLACKLIST = [ THREADED_INDEX_PACK_BLOCKLIST = [
'https://chromium.googlesource.com/chromium/reference_builds/chrome_win.git' 'https://chromium.googlesource.com/chromium/reference_builds/chrome_win.git'
] ]
@ -1193,7 +1193,7 @@ def DefaultIndexPackConfig(url=''):
performance.""" performance."""
cache_limit = DefaultDeltaBaseCacheLimit() cache_limit = DefaultDeltaBaseCacheLimit()
result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] 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']) result.extend(['-c', 'pack.threads=1'])
return result return result

@ -17,7 +17,7 @@ import git_common as git
FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): *(.*)$') FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): *(.*)$')
CHROME_COMMIT_POSITION_PATTERN = re.compile(r'^([\w/\-\.]+)@{#(\d+)}$') 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): def normalize_name(header):
@ -27,7 +27,7 @@ def normalize_name(header):
def parse_footer(line): def parse_footer(line):
"""Returns footer's (key, value) if footer is valid, else None.""" """Returns footer's (key, value) if footer is valid, else None."""
match = FOOTER_PATTERN.match(line) 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 (match.group(1), match.group(2))
return None return None

@ -7,7 +7,7 @@
# pygtk.require(). # pygtk.require().
#init-hook= #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. # paths.
ignore=CVS ignore=CVS

Loading…
Cancel
Save