Skip to content

Commit c8783af

Browse files
TrottMyles Borins
authored andcommitted
lib,test,tools: alignment on variable assignments
Correct alignment on variable assignments that span multiple lines in preparation for lint rule to enforce such alignment. PR-URL: #6242 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c0e9c94 commit c8783af

25 files changed

+210
-189
lines changed

lib/child_process.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,10 @@ function checkExecSyncError(ret) {
463463
ret.error = null;
464464

465465
if (!err) {
466-
var msg = 'Command failed: ' +
467-
(ret.cmd ? ret.cmd : ret.args.join(' ')) +
468-
(ret.stderr ? '\n' + ret.stderr.toString() : '');
466+
var msg = 'Command failed: ';
467+
msg += ret.cmd || ret.args.join(' ');
468+
if (ret.stderr)
469+
msg += '\n' + ret.stderr.toString();
469470
err = new Error(msg);
470471
}
471472

lib/repl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ exports._builtinLibs = ['assert', 'buffer', 'child_process', 'cluster',
7070
'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'];
7171

7272

73-
const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, ' +
74-
'const, function, class) not yet supported outside strict mode';
73+
const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, const, function, ' +
74+
'class) not yet supported outside strict mode';
7575

7676

7777
class LineParser {

lib/util.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,12 @@ function formatPrimitive(ctx, value) {
460460
var type = typeof value;
461461

462462
if (type === 'string') {
463-
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
464-
.replace(/'/g, "\\'")
465-
.replace(/\\"/g, '"') + '\'';
463+
var simple = '\'' +
464+
JSON.stringify(value)
465+
.replace(/^"|"$/g, '')
466+
.replace(/'/g, "\\'")
467+
.replace(/\\"/g, '"') +
468+
'\'';
466469
return ctx.stylize(simple, 'string');
467470
}
468471
if (type === 'number') {

lib/zlib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const binding = process.binding('zlib');
66
const util = require('util');
77
const assert = require('assert').ok;
88
const kMaxLength = require('buffer').kMaxLength;
9-
const kRangeErrorMessage = 'Cannot create final Buffer. ' +
10-
'It would be larger than 0x' + kMaxLength.toString(16) + ' bytes.';
9+
const kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' +
10+
'than 0x' + kMaxLength.toString(16) + ' bytes';
1111

1212
// zlib doesn't provide these, so kludge them in following the same
1313
// const naming scheme zlib uses.

test/parallel/test-buffer-alloc.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -536,17 +536,17 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
536536
{
537537
// big example
538538
const quote = 'Man is distinguished, not only by his reason, but by this ' +
539-
'singular passion from other animals, which is a lust ' +
540-
'of the mind, that by a perseverance of delight in the ' +
541-
'continued and indefatigable generation of knowledge, exceeds ' +
542-
'the short vehemence of any carnal pleasure.';
539+
'singular passion from other animals, which is a lust ' +
540+
'of the mind, that by a perseverance of delight in the ' +
541+
'continued and indefatigable generation of knowledge, ' +
542+
'exceeds the short vehemence of any carnal pleasure.';
543543
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
544-
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' +
545-
'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' +
546-
'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' +
547-
'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' +
548-
'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' +
549-
'c3VyZS4=';
544+
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' +
545+
'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' +
546+
'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' +
547+
'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' +
548+
'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' +
549+
'5hbCBwbGVhc3VyZS4=';
550550
assert.equal(expected, (Buffer.from(quote)).toString('base64'));
551551

552552
let b = Buffer.allocUnsafe(1024);
@@ -556,11 +556,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
556556

557557
// check that the base64 decoder ignores whitespace
558558
const expectedWhite = expected.slice(0, 60) + ' \n' +
559-
expected.slice(60, 120) + ' \n' +
560-
expected.slice(120, 180) + ' \n' +
561-
expected.slice(180, 240) + ' \n' +
562-
expected.slice(240, 300) + '\n' +
563-
expected.slice(300, 360) + '\n';
559+
expected.slice(60, 120) + ' \n' +
560+
expected.slice(120, 180) + ' \n' +
561+
expected.slice(180, 240) + ' \n' +
562+
expected.slice(240, 300) + '\n' +
563+
expected.slice(300, 360) + '\n';
564564
b = Buffer.allocUnsafe(1024);
565565
bytesWritten = b.write(expectedWhite, 0, 'base64');
566566
assert.equal(quote.length, bytesWritten);
@@ -574,11 +574,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
574574

575575
// check that the base64 decoder ignores illegal chars
576576
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
577-
expected.slice(60, 120) + ' \xff' +
578-
expected.slice(120, 180) + ' \x00' +
579-
expected.slice(180, 240) + ' \x98' +
580-
expected.slice(240, 300) + '\x03' +
581-
expected.slice(300, 360);
577+
expected.slice(60, 120) + ' \xff' +
578+
expected.slice(120, 180) + ' \x00' +
579+
expected.slice(180, 240) + ' \x98' +
580+
expected.slice(240, 300) + '\x03' +
581+
expected.slice(300, 360);
582582
b = Buffer.from(expectedIllegal, 'base64');
583583
assert.equal(quote.length, b.length);
584584
assert.equal(quote, b.toString('ascii', 0, quote.length));

test/parallel/test-buffer.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -533,17 +533,17 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
533533
{
534534
// big example
535535
const quote = 'Man is distinguished, not only by his reason, but by this ' +
536-
'singular passion from other animals, which is a lust ' +
537-
'of the mind, that by a perseverance of delight in the ' +
538-
'continued and indefatigable generation of knowledge, exceeds ' +
539-
'the short vehemence of any carnal pleasure.';
536+
'singular passion from other animals, which is a lust ' +
537+
'of the mind, that by a perseverance of delight in the ' +
538+
'continued and indefatigable generation of knowledge, ' +
539+
'exceeds the short vehemence of any carnal pleasure.';
540540
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
541-
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' +
542-
'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' +
543-
'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' +
544-
'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' +
545-
'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' +
546-
'c3VyZS4=';
541+
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' +
542+
'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' +
543+
'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' +
544+
'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' +
545+
'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' +
546+
'5hbCBwbGVhc3VyZS4=';
547547
assert.equal(expected, (new Buffer(quote)).toString('base64'));
548548

549549
let b = new Buffer(1024);
@@ -553,11 +553,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
553553

554554
// check that the base64 decoder ignores whitespace
555555
const expectedWhite = expected.slice(0, 60) + ' \n' +
556-
expected.slice(60, 120) + ' \n' +
557-
expected.slice(120, 180) + ' \n' +
558-
expected.slice(180, 240) + ' \n' +
559-
expected.slice(240, 300) + '\n' +
560-
expected.slice(300, 360) + '\n';
556+
expected.slice(60, 120) + ' \n' +
557+
expected.slice(120, 180) + ' \n' +
558+
expected.slice(180, 240) + ' \n' +
559+
expected.slice(240, 300) + '\n' +
560+
expected.slice(300, 360) + '\n';
561561
b = new Buffer(1024);
562562
bytesWritten = b.write(expectedWhite, 0, 'base64');
563563
assert.equal(quote.length, bytesWritten);
@@ -571,11 +571,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
571571

572572
// check that the base64 decoder ignores illegal chars
573573
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
574-
expected.slice(60, 120) + ' \xff' +
575-
expected.slice(120, 180) + ' \x00' +
576-
expected.slice(180, 240) + ' \x98' +
577-
expected.slice(240, 300) + '\x03' +
578-
expected.slice(300, 360);
574+
expected.slice(60, 120) + ' \xff' +
575+
expected.slice(120, 180) + ' \x00' +
576+
expected.slice(180, 240) + ' \x98' +
577+
expected.slice(240, 300) + '\x03' +
578+
expected.slice(300, 360);
579579
b = new Buffer(expectedIllegal, 'base64');
580580
assert.equal(quote.length, b.length);
581581
assert.equal(quote, b.toString('ascii', 0, quote.length));

test/parallel/test-cluster-worker-exit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function checkResults(expected_results, results) {
107107
const expected = expected_results[k];
108108

109109
var msg = (expected[1] || '') +
110-
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
110+
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
111111

112112
if (expected && expected.length) {
113113
assert.equal(actual, expected[0], msg);

test/parallel/test-cluster-worker-kill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function checkResults(expected_results, results) {
9090
const expected = expected_results[k];
9191

9292
var msg = (expected[1] || '') +
93-
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
93+
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
9494
if (expected && expected.length) {
9595
assert.equal(actual, expected[0], msg);
9696
} else {

test/parallel/test-domain-no-error-handler-abort-on-uncaught.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ if (process.argv[2] === 'child') {
160160

161161
child.on('exit', function onExit(exitCode, signal) {
162162
const errMsg = 'Test at index ' + testIndex + ' should have aborted ' +
163-
'but instead exited with exit code ' + exitCode + ' and signal ' +
164-
signal;
163+
'but instead exited with exit code ' + exitCode +
164+
' and signal ' + signal;
165165
assert(common.nodeProcessAborted(exitCode, signal), errMsg);
166166
});
167167
});

test/parallel/test-error-reporting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var exits = 0;
88

99
function errExec(script, callback) {
1010
var cmd = '"' + process.argv[0] + '" "' +
11-
path.join(common.fixturesDir, script) + '"';
11+
path.join(common.fixturesDir, script) + '"';
1212
return exec(cmd, function(err, stdout, stderr) {
1313
// There was some error
1414
assert.ok(err);

0 commit comments

Comments
 (0)