Skip to content

Commit fc0ed2e

Browse files
Trottevanlucas
authored andcommitted
lib,benchmark,test: implement consistent braces
This change is in preparation for lint-enforced brace style. PR-URL: #7630 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent cc7fdf4 commit fc0ed2e

30 files changed

+59
-92
lines changed

benchmark/child_process/child-process-read-ipc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
2-
if (process.argv[2] === 'child')
3-
{
2+
if (process.argv[2] === 'child') {
43
const len = +process.argv[3];
54
const msg = `"${'.'.repeat(len)}"`;
65
while (true) {

lib/_stream_readable.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,11 @@ Readable.prototype.wrap = function(stream) {
803803
// important when wrapping filters and duplexes.
804804
for (var i in stream) {
805805
if (this[i] === undefined && typeof stream[i] === 'function') {
806-
this[i] = function(method) { return function() {
807-
return stream[method].apply(stream, arguments);
808-
}; }(i);
806+
this[i] = function(method) {
807+
return function() {
808+
return stream[method].apply(stream, arguments);
809+
};
810+
}(i);
809811
}
810812
}
811813

lib/module.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,7 @@ Module._preloadModules = function(requests) {
622622
var parent = new Module('internal/preload', null);
623623
try {
624624
parent.paths = Module._nodeModulePaths(process.cwd());
625-
}
626-
catch (e) {
625+
} catch (e) {
627626
if (e.code !== 'ENOENT') {
628627
throw e;
629628
}

lib/net.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,7 @@ function createServerHandle(address, port, addressType, fd) {
11581158
if (typeof fd === 'number' && fd >= 0) {
11591159
try {
11601160
handle = createHandle(fd);
1161-
}
1162-
catch (e) {
1161+
} catch (e) {
11631162
// Not a fd we can listen on. This will trigger an error.
11641163
debug('listen invalid fd=' + fd + ': ' + e.message);
11651164
return uv.UV_EINVAL;

test/internet/test-dgram-broadcast-multi-process.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ if (process.argv[2] !== 'child') {
9696
//all child process are listening, so start sending
9797
sendSocket.sendNext();
9898
}
99-
}
100-
else if (msg.message) {
99+
} else if (msg.message) {
101100
worker.messagesReceived.push(msg.message);
102101

103102
if (worker.messagesReceived.length === messages.length) {

test/parallel/test-child-process-fork-exec-path.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ if (process.env.FORK) {
1212
assert.equal(process.argv[0], copyPath);
1313
process.send(msg);
1414
process.exit();
15-
}
16-
else {
15+
} else {
1716
common.refreshTmpDir();
1817
try {
1918
fs.unlinkSync(copyPath);
20-
}
21-
catch (e) {
19+
} catch (e) {
2220
if (e.code !== 'ENOENT') throw e;
2321
}
2422
fs.writeFileSync(copyPath, fs.readFileSync(nodePath));

test/parallel/test-child-process-recv-handle.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,12 @@ function worker() {
4949
if (n === 1) {
5050
assert.equal(msg, 'one');
5151
assert.equal(handle, undefined);
52-
}
53-
else if (n === 2) {
52+
} else if (n === 2) {
5453
assert.equal(msg, 'two');
5554
assert.equal(typeof handle, 'object'); // Also matches null, therefore...
5655
assert.ok(handle); // also check that it's truthy.
5756
handle.close();
58-
}
59-
else if (n === 3) {
57+
} else if (n === 3) {
6058
assert.equal(msg, 'three');
6159
assert.equal(handle, undefined);
6260
process.exit();

test/parallel/test-cluster-basic.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ if (cluster.isWorker) {
1818
http.Server(function() {
1919

2020
}).listen(common.PORT, '127.0.0.1');
21-
}
22-
23-
else if (cluster.isMaster) {
21+
} else if (cluster.isMaster) {
2422

2523
var checks = {
2624
cluster: {

test/parallel/test-cluster-bind-privileged-port.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ if (cluster.isMaster) {
1818
cluster.fork().on('exit', common.mustCall(function(exitCode) {
1919
assert.equal(exitCode, 0);
2020
}));
21-
}
22-
else {
21+
} else {
2322
var s = net.createServer(common.fail);
2423
s.listen(42, common.fail.bind(null, 'listen should have failed'));
2524
s.on('error', common.mustCall(function(err) {

test/parallel/test-cluster-bind-twice.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ if (!id) {
6464
process.on('exit', function() {
6565
assert(ok);
6666
});
67-
}
68-
else if (id === 'one') {
67+
} else if (id === 'one') {
6968
if (cluster.isMaster) return startWorker();
7069

7170
http.createServer(common.fail).listen(common.PORT, function() {
@@ -75,8 +74,7 @@ else if (id === 'one') {
7574
process.on('message', function(m) {
7675
if (m === 'QUIT') process.exit();
7776
});
78-
}
79-
else if (id === 'two') {
77+
} else if (id === 'two') {
8078
if (cluster.isMaster) return startWorker();
8179

8280
let ok = false;
@@ -96,8 +94,7 @@ else if (id === 'two') {
9694
ok = true;
9795
});
9896
});
99-
}
100-
else {
97+
} else {
10198
assert(0); // bad command line argument
10299
}
103100

0 commit comments

Comments
 (0)