Skip to content

Commit

Permalink
🏗 Update forbidden terms for matching and check in test folders (#35530)
Browse files Browse the repository at this point in the history
1. Update some non-inclusive terms to match spellings that were missed.
2. Update `checkProse` so that it implies `checkInTestFolder`, since prose can occur anywhere.
3. Update files to remove non-inclusive terms.
  • Loading branch information
alanorozco committed Aug 4, 2021
1 parent 9dc6c2c commit e02167a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions build-system/test-configs/forbidden-terms.js
Expand Up @@ -52,7 +52,8 @@ const realiasGetMode =
* check term in files whose path includes /test/ (false by default)
*
* - checkProse:
* check term in comments and documentation (.md) (false by default)
* check term in comments and documentation (.md)
* (false by default, implies `checkInTestFolder`)
*/
let ForbiddenTermDef;

Expand All @@ -64,15 +65,15 @@ const forbiddenTermsGlobal = {
'DO NOT SUBMIT': {
checkProse: true,
},
'whitelist|white-list': {
'white[-\\s]*list': {
message: 'Please use the term allowlist instead',
checkProse: true,
},
'blacklist|black-list': {
'black[-\\s]*list': {
message: 'Please use the term denylist instead',
checkProse: true,
},
'grandfather|grandfathered': {
'grandfather': {
message: 'Please use the term legacy instead',
checkProse: true,
},
Expand Down Expand Up @@ -1129,7 +1130,7 @@ function matchForbiddenTerms(srcFile, contents, terms) {
// if needed but that might be too permissive.
if (
(Array.isArray(allowlist) && allowlist.indexOf(srcFile) != -1) ||
(isInTestFolder(srcFile) && !checkInTestFolder) ||
(isInTestFolder(srcFile) && !checkInTestFolder && !checkProse) ||
(srcFile.endsWith('.md') && !checkProse)
) {
return [];
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-youtube/0.1/test/test-amp-youtube.js
Expand Up @@ -111,9 +111,9 @@ describes.realWin(
});
const iframe = yt.querySelector('iframe');
expect(iframe.src).to.contain('myParam=hello%20world');
// data-param-autoplay is black listed in favor of just autoplay
// data-param-autoplay is disallowed in favor of just autoplay
expect(iframe.src).to.not.contain('autoplay=1');
// data-param-loop is black listed in favor of just loop for single videos
// data-param-loop is disallowed in favor of just loop for single videos
expect(iframe.src).to.not.contain('loop=1');
// playsinline should default to 1 if not provided.
expect(iframe.src).to.contain('playsinline=1');
Expand Down
3 changes: 2 additions & 1 deletion extensions/amp-youtube/1.0/test/test-component.js
Expand Up @@ -78,8 +78,9 @@ describes.realWin('YouTube preact component v1.0', {}, (env) => {
const iframe = wrapper.find('iframe');

expect(iframe.prop('src')).to.contain('&myparam=hello%20world');
// data-param-autoplay is disallowed in favor of just autoplay
expect(iframe.prop('src')).to.not.contain('autoplay=1');
// data-param-loop is black listed in favor of just loop for single videos
// data-param-loop is disallowed in favor of just loop for single videos
expect(iframe.prop('src')).to.not.contain('loop=1');
// playsinline should default to 1 if not provided.
expect(iframe.prop('src')).to.contain('playsinline=1');
Expand Down

0 comments on commit e02167a

Please sign in to comment.