From 098586197089d3bd63bcdee543c546c5eb4c2bdf Mon Sep 17 00:00:00 2001 From: Ayu Ishii Date: Fri, 26 Jun 2020 18:00:52 +0000 Subject: [PATCH] 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 Commit-Queue: Ayu Ishii --- cpplint.py | 20 ++++++++++---------- gclient_eval.py | 6 +++--- gclient_utils.py | 4 ++-- git_footers.py | 4 ++-- pylintrc | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cpplint.py b/cpplint.py index daf60683f..0d4a799d5 100755 --- a/cpplint.py +++ b/cpplint.py @@ -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 diff --git a/gclient_eval.py b/gclient_eval.py index c437b50ee..a6dd03b6a 100644 --- a/gclient_eval.py +++ b/gclient_eval.py @@ -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. diff --git a/gclient_utils.py b/gclient_utils.py index 8267b9662..c62d58985 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -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 diff --git a/git_footers.py b/git_footers.py index 8d959f210..b882ac3a0 100755 --- a/git_footers.py +++ b/git_footers.py @@ -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 diff --git a/pylintrc b/pylintrc index 5690f2766..326a855c4 100644 --- a/pylintrc +++ b/pylintrc @@ -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