Skip to content

Commit f532c9a

Browse files
authored
Change to allowlist/denylist. (#3546)
1 parent 230ca87 commit f532c9a

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

e2e/integration_tests/setup_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function parseTags(tagsInput: string): string[] {
6262
}
6363

6464
/**
65-
* Run Jasmine tests only for whitelisted tags.
65+
* Run Jasmine tests only for allowlisted tags.
6666
*/
6767
function setupTestFilters(tags: string[] = []) {
6868
const env = jasmine.getEnv();

scripts/find-affected-packages.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {readdirSync, statSync, writeFileSync} = require('fs');
2121
const {join} = require('path');
2222
const fs = require('fs');
2323

24-
const filesWhitelistToTriggerBuild = [
24+
const filesAllowlistToTriggerBuild = [
2525
'cloudbuild.yml', 'package.json', 'tsconfig.json', 'tslint.json',
2626
'scripts/find-affected-packages.js', 'scripts/run-build.sh'
2727
];
@@ -84,13 +84,13 @@ shell.cd('..');
8484
console.log(); // Break up the console for readability.
8585

8686
let triggerAllBuilds = false;
87-
let whitelistDiffOutput = [];
88-
filesWhitelistToTriggerBuild.forEach(fileToTriggerBuild => {
87+
let allowlistDiffOutput = [];
88+
filesAllowlistToTriggerBuild.forEach(fileToTriggerBuild => {
8989
const diffOutput = diff(fileToTriggerBuild);
9090
if (diffOutput !== '') {
9191
console.log(fileToTriggerBuild, 'has changed. Triggering all builds.');
9292
triggerAllBuilds = true;
93-
whitelistDiffOutput.push(diffOutput);
93+
allowlistDiffOutput.push(diffOutput);
9494
}
9595
});
9696

@@ -108,7 +108,7 @@ dirs.forEach(dir => {
108108

109109
const shouldDiff = diffOutput !== '' || triggerAllBuilds;
110110
if (shouldDiff) {
111-
const diffContents = whitelistDiffOutput.join('\n') + '\n' + diffOutput;
111+
const diffContents = allowlistDiffOutput.join('\n') + '\n' + diffOutput;
112112
writeFileSync(join(dir, 'run-ci'), diffContents);
113113
triggeredBuilds.push(dir);
114114
}

tfjs-backend-wasm/tools/cpplint.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,8 +3866,8 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
38663866

38673867
# Block bodies should not be followed by a semicolon. Due to C++11
38683868
# brace initialization, there are more places where semicolons are
3869-
# required than not, so we use a whitelist approach to check these
3870-
# rather than a blacklist. These are the places where "};" should
3869+
# required than not, so we use an allowlist approach to check these
3870+
# rather than a denylist. These are the places where "};" should
38713871
# be replaced by just "}":
38723872
# 1. Some flavor of block following closing parenthesis:
38733873
# for (;;) {};
@@ -3924,11 +3924,11 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
39243924
# - INTERFACE_DEF
39253925
# - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED:
39263926
#
3927-
# We implement a whitelist of safe macros instead of a blacklist of
3927+
# We implement an allowlist of safe macros instead of a denylist of
39283928
# unsafe macros, even though the latter appears less frequently in
39293929
# google code and would have been easier to implement. This is because
3930-
# the downside for getting the whitelist wrong means some extra
3931-
# semicolons, while the downside for getting the blacklist wrong
3930+
# the downside for getting the allowlist wrong means some extra
3931+
# semicolons, while the downside for getting the denylist wrong
39323932
# would result in compile errors.
39333933
#
39343934
# In addition to macros, we also don't want to warn on
@@ -5124,19 +5124,19 @@ def CheckForNonConstReference(filename, clean_lines, linenum,
51245124
#
51255125
# We also accept & in static_assert, which looks like a function but
51265126
# it's actually a declaration expression.
5127-
whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
5127+
allowlisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
51285128
r'operator\s*[<>][<>]|'
51295129
r'static_assert|COMPILE_ASSERT'
51305130
r')\s*\(')
5131-
if Search(whitelisted_functions, line):
5131+
if Search(allowlisted_functions, line):
51325132
return
51335133
elif not Search(r'\S+\([^)]*$', line):
5134-
# Don't see a whitelisted function on this line. Actually we
5134+
# Don't see an allowlisted function on this line. Actually we
51355135
# didn't see any function name on this line, so this is likely a
51365136
# multi-line parameter list. Try a bit harder to catch this case.
51375137
for i in xrange(2):
51385138
if (linenum > i and
5139-
Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
5139+
Search(allowlisted_functions, clean_lines.elided[linenum - i - 1])):
51405140
return
51415141

51425142
decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body

0 commit comments

Comments
 (0)