Skip to content

Commit 3160073

Browse files
Trottjasnell
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 c1d82ac commit 3160073

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
@@ -67,8 +67,8 @@ exports.writer = util.inspect;
6767
exports._builtinLibs = internalModule.builtinLibs;
6868

6969

70-
const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, ' +
71-
'const, function, class) not yet supported outside strict mode';
70+
const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, const, function, ' +
71+
'class) not yet supported outside strict mode';
7272

7373

7474
class LineParser {

lib/util.js

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

499499
if (type === 'string') {
500-
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
501-
.replace(/'/g, "\\'")
502-
.replace(/\\"/g, '"') + '\'';
500+
var simple = '\'' +
501+
JSON.stringify(value)
502+
.replace(/^"|"$/g, '')
503+
.replace(/'/g, "\\'")
504+
.replace(/\\"/g, '"') +
505+
'\'';
503506
return ctx.stylize(simple, 'string');
504507
}
505508
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
@@ -535,17 +535,17 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
535535
{
536536
// big example
537537
const quote = 'Man is distinguished, not only by his reason, but by this ' +
538-
'singular passion from other animals, which is a lust ' +
539-
'of the mind, that by a perseverance of delight in the ' +
540-
'continued and indefatigable generation of knowledge, exceeds ' +
541-
'the short vehemence of any carnal pleasure.';
538+
'singular passion from other animals, which is a lust ' +
539+
'of the mind, that by a perseverance of delight in the ' +
540+
'continued and indefatigable generation of knowledge, ' +
541+
'exceeds the short vehemence of any carnal pleasure.';
542542
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
543-
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' +
544-
'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' +
545-
'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' +
546-
'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' +
547-
'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' +
548-
'c3VyZS4=';
543+
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' +
544+
'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' +
545+
'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' +
546+
'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' +
547+
'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' +
548+
'5hbCBwbGVhc3VyZS4=';
549549
assert.equal(expected, (Buffer.from(quote)).toString('base64'));
550550

551551
let b = Buffer.allocUnsafe(1024);
@@ -555,11 +555,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
555555

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

574574
// check that the base64 decoder ignores illegal chars
575575
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
576-
expected.slice(60, 120) + ' \xff' +
577-
expected.slice(120, 180) + ' \x00' +
578-
expected.slice(180, 240) + ' \x98' +
579-
expected.slice(240, 300) + '\x03' +
580-
expected.slice(300, 360);
576+
expected.slice(60, 120) + ' \xff' +
577+
expected.slice(120, 180) + ' \x00' +
578+
expected.slice(180, 240) + ' \x98' +
579+
expected.slice(240, 300) + '\x03' +
580+
expected.slice(300, 360);
581581
b = Buffer.from(expectedIllegal, 'base64');
582582
assert.equal(quote.length, b.length);
583583
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)