style(dev-infra): enforce format on newly included files (#36940)

Historically files to be formatted were added to a listing (via matchers)
to be included in formatting.  Instead, this change begins efforts to
instead include all files in format enforcement, relying instead on an
opt out methodology.

PR Close #36940
This commit is contained in:
Joey Perrott
2020-05-05 13:12:39 -07:00
committed by Misko Hevery
parent 45a8f340d9
commit fcd934ccf6
11 changed files with 88 additions and 83 deletions

2
scripts/github/utils/github_closes.js Executable file → Normal file
View File

@ -28,7 +28,7 @@ if (require.main === module) {
function rewriteMsg(msg, prNo) {
var lines = msg.split(/\n/);
lines[0] += ' (#' + prNo +')';
lines[0] += ' (#' + prNo + ')';
lines.push('PR Close #' + prNo);
return lines.join('\n');
}

View File

@ -34,14 +34,14 @@ function extractPaths(obj, paths) {
paths.forEach(function(exp) {
var objs = obj instanceof Array ? [].concat(obj) : [obj];
exp.split('.').forEach(function(name) {
for(var i = 0; i < objs.length; i++) {
for (var i = 0; i < objs.length; i++) {
var o = objs[i];
if (o instanceof Array) {
// Expand and do over
objs = objs.slice(0, i).concat(o).concat(objs.slice(i+1, objs.length));
objs = objs.slice(0, i).concat(o).concat(objs.slice(i + 1, objs.length));
i--;
} else {
name.split("=").forEach(function(name, index) {
name.split('=').forEach(function(name, index) {
if (index == 0) {
objs[i] = o = o[name];
} else if (name.charAt(0) == '^') {
@ -54,7 +54,7 @@ function extractPaths(obj, paths) {
}
}
});
lines.push(objs.join("|"));
lines.push(objs.join('|'));
});
return lines;
}

View File

@ -8,40 +8,42 @@
* found in the LICENSE file at https://angular.io/license
*/
var assert = require("assert");
var assert = require('assert');
var extractPaths = require('./json_extract').extractPaths;
var SAMPLE_LABELS = [
{
"id": 149476251,
"url": "https://api.github.com/repos/angular/angular/labels/cla:%20yes",
"name": "cla: yes",
"color": "009800",
"default": false
'id': 149476251,
'url': 'https://api.github.com/repos/angular/angular/labels/cla:%20yes',
'name': 'cla: yes',
'color': '009800',
'default': false
},
{
"id": 533874619,
"url": "https://api.github.com/repos/angular/angular/labels/comp:%20aio",
"name": "comp: aio",
"color": "c7def8",
"default": false
'id': 533874619,
'url': 'https://api.github.com/repos/angular/angular/labels/comp:%20aio',
'name': 'comp: aio',
'color': 'c7def8',
'default': false
},
{
"id": 133556520,
"url": "https://api.github.com/repos/angular/angular/labels/PR%20action:%20merge",
"name": "PR action: merge",
"color": "99ff66",
"default": false
'id': 133556520,
'url': 'https://api.github.com/repos/angular/angular/labels/PR%20action:%20merge',
'name': 'PR action: merge',
'color': '99ff66',
'default': false
},
{
"id": 655699838,
"url": "https://api.github.com/repos/angular/angular/labels/PR%20target:%20master%20&%20patch",
"name": "PR target: master & patch",
"color": "5319e7",
"default": false
'id': 655699838,
'url': 'https://api.github.com/repos/angular/angular/labels/PR%20target:%20master%20&%20patch',
'name': 'PR target: master & patch',
'color': '5319e7',
'default': false
}
];
assert.deepEqual(extractPaths({head: {label: 'value1'}}, ['head.label']), ['value1']);
assert.deepEqual(extractPaths(SAMPLE_LABELS, ['name']), ['cla: yes|comp: aio|PR action: merge|PR target: master & patch']);
assert.deepEqual(
extractPaths(SAMPLE_LABELS, ['name']),
['cla: yes|comp: aio|PR action: merge|PR target: master & patch']);
assert.deepEqual(extractPaths(SAMPLE_LABELS, ['name=^PR target:']), ['PR target: master & patch']);