Inclusive language in PRESUBMIT.py.
Bug: webrtc:11680
Change-Id: I6eb1f34580174cc8b043bc0811edf2d68f28f26b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178387
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31592}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index e1c9b8e..47a1be6 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -14,7 +14,7 @@
from contextlib import contextmanager
# Files and directories that are *skipped* by cpplint in the presubmit script.
-CPPLINT_BLACKLIST = [
+CPPLINT_EXCEPTIONS = [
'api/video_codecs/video_decoder.h',
'common_types.cc',
'common_types.h',
@@ -45,13 +45,13 @@
#
# Justifications for each filter:
# - build/c++11 : Rvalue ref checks are unreliable (false positives),
-# include file and feature blacklists are
+# include file and feature blocklists are
# google3-specific.
# - runtime/references : Mutable references are not banned by the Google
# C++ style guide anymore (starting from May 2020).
# - whitespace/operators: Same as above (doesn't seem sufficient to eliminate
# all move-related errors).
-BLACKLIST_LINT_FILTERS = [
+DISABLED_LINT_FILTERS = [
'-build/c++11',
'-runtime/references',
'-whitespace/operators',
@@ -176,7 +176,7 @@
"""Checks to remind proper changing of native APIs."""
files = []
source_file_filter = lambda x: input_api.FilterSourceFile(
- x, white_list=[r'.+\.(gn|gni|h)$'])
+ x, allow_list=[r'.+\.(gn|gni|h)$'])
for f in input_api.AffectedSourceFiles(source_file_filter):
for path in API_DIRS:
dn = os.path.dirname(f.LocalPath())
@@ -262,9 +262,9 @@
'use FRIEND_TEST_ALL_PREFIXES() instead.\n' + '\n'.join(problems))]
-def IsLintBlacklisted(blacklist_paths, file_path):
- """ Checks if a file is blacklisted for lint check."""
- for path in blacklist_paths:
+def IsLintDisabled(disabled_paths, file_path):
+ """ Checks if a file is disabled for lint check."""
+ for path in disabled_paths:
if file_path == path or os.path.dirname(file_path).startswith(path):
return True
return False
@@ -272,7 +272,7 @@
def CheckApprovedFilesLintClean(input_api, output_api,
source_file_filter=None):
- """Checks that all new or non-blacklisted .cc and .h files pass cpplint.py.
+ """Checks that all new or non-exempt .cc and .h files pass cpplint.py.
This check is based on CheckChangeLintsClean in
depot_tools/presubmit_canned_checks.py but has less filters and only checks
added files."""
@@ -285,22 +285,22 @@
cpplint._cpplint_state.ResetErrorCounts()
lint_filters = cpplint._Filters()
- lint_filters.extend(BLACKLIST_LINT_FILTERS)
+ lint_filters.extend(DISABLED_LINT_FILTERS)
cpplint._SetFilters(','.join(lint_filters))
- # Create a platform independent blacklist for cpplint.
- blacklist_paths = [input_api.os_path.join(*path.split('/'))
- for path in CPPLINT_BLACKLIST]
+ # Create a platform independent exempt list for cpplint.
+ disabled_paths = [input_api.os_path.join(*path.split('/'))
+ for path in CPPLINT_EXCEPTIONS]
# Use the strictest verbosity level for cpplint.py (level 1) which is the
# default when running cpplint.py from command line. To make it possible to
# work with not-yet-converted code, we're only applying it to new (or
- # moved/renamed) files and files not listed in CPPLINT_BLACKLIST.
+ # moved/renamed) files and files not listed in CPPLINT_EXCEPTIONS.
verbosity_level = 1
files = []
for f in input_api.AffectedSourceFiles(source_file_filter):
# Note that moved/renamed files also count as added.
- if f.Action() == 'A' or not IsLintBlacklisted(blacklist_paths,
+ if f.Action() == 'A' or not IsLintDisabled(disabled_paths,
f.LocalPath()):
files.append(f.AbsoluteLocalPath())
@@ -605,8 +605,8 @@
def CheckGnChanges(input_api, output_api):
file_filter = lambda x: (input_api.FilterSourceFile(
- x, white_list=(r'.+\.(gn|gni)$',),
- black_list=(r'.*/presubmit_checks_lib/testdata/.*',)))
+ x, allow_list=(r'.+\.(gn|gni)$',),
+ block_list=(r'.*/presubmit_checks_lib/testdata/.*',)))
gn_files = []
for f in input_api.AffectedSourceFiles(file_filter):
@@ -796,7 +796,7 @@
input_api,
output_api,
directory,
- whitelist=[r'.+_test\.py$']))
+ allowlist=[r'.+_test\.py$']))
return input_api.RunTests(tests, parallel=True)
@@ -850,17 +850,18 @@
results = []
# Filter out files that are in objc or ios dirs from being cpplint-ed since
# they do not follow C++ lint rules.
- black_list = input_api.DEFAULT_BLACK_LIST + (
+ exception_list = input_api.DEFAULT_BLACK_LIST + (
r".*\bobjc[\\\/].*",
r".*objc\.[hcm]+$",
)
- source_file_filter = lambda x: input_api.FilterSourceFile(x, None, black_list)
+ source_file_filter = lambda x: input_api.FilterSourceFile(x, None,
+ exception_list)
results.extend(CheckApprovedFilesLintClean(
input_api, output_api, source_file_filter))
results.extend(input_api.canned_checks.CheckLicense(
input_api, output_api, _LicenseHeader(input_api)))
results.extend(input_api.canned_checks.RunPylint(input_api, output_api,
- black_list=(r'^base[\\\/].*\.py$',
+ block_list=(r'^base[\\\/].*\.py$',
r'^build[\\\/].*\.py$',
r'^buildtools[\\\/].*\.py$',
r'^infra[\\\/].*\.py$',
@@ -887,12 +888,12 @@
# Also we will skip most checks for third_party directory.
third_party_filter_list = (r'^third_party[\\\/].+',)
eighty_char_sources = lambda x: input_api.FilterSourceFile(x,
- black_list=build_file_filter_list + objc_filter_list +
+ block_list=build_file_filter_list + objc_filter_list +
third_party_filter_list)
hundred_char_sources = lambda x: input_api.FilterSourceFile(x,
- white_list=objc_filter_list)
+ allow_list=objc_filter_list)
non_third_party_sources = lambda x: input_api.FilterSourceFile(x,
- black_list=third_party_filter_list)
+ block_list=third_party_filter_list)
results.extend(input_api.canned_checks.CheckLongLines(
input_api, output_api, maxlen=80, source_file_filter=eighty_char_sources))
@@ -1073,7 +1074,7 @@
# eval-ed and thus doesn't have __file__.
error_msg = """{} should be listed in {}."""
results = []
- orphan_blacklist = [
+ exempt_paths = [
os.path.join('tools_webrtc', 'ios', 'SDK'),
]
with _AddToPath(input_api.os_path.join(
@@ -1082,7 +1083,7 @@
from check_orphan_headers import IsHeaderInBuildGn
file_filter = lambda x: input_api.FilterSourceFile(
- x, black_list=orphan_blacklist) and source_file_filter(x)
+ x, block_list=exempt_paths) and source_file_filter(x)
for f in input_api.AffectedSourceFiles(file_filter):
if f.LocalPath().endswith('.h'):
file_path = os.path.abspath(f.LocalPath())
@@ -1101,7 +1102,7 @@
error_msg = 'File {} must end with exactly one newline.'
results = []
file_filter = lambda x: input_api.FilterSourceFile(
- x, white_list=(r'.+\.proto$',)) and source_file_filter(x)
+ x, allow_list=(r'.+\.proto$',)) and source_file_filter(x)
for f in input_api.AffectedSourceFiles(file_filter):
file_path = f.LocalPath()
with open(file_path) as f: