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 <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c0e9c94 commit c8783af

25 files changed

Lines changed: 210 additions & 189 deletions

‎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-
varmsg='Command failed: '+
467-
(ret.cmd ? ret.cmd : ret.args.join(' '))+
468-
(ret.stderr ? '\n'+ret.stderr.toString() : '');
466+
varmsg='Command failed: ';
467+
msg+=ret.cmd||ret.args.join(' ');
468+
if(ret.stderr)
469+
msg+='\n'+ret.stderr.toString();
469470
err=newError(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-
constBLOCK_SCOPED_ERROR='Block-scoped declarations (let, '+
74-
'const, function, class) not yet supported outside strict mode';
73+
constBLOCK_SCOPED_ERROR='Block-scoped declarations (let, const, function, '+
74+
'class) not yet supported outside strict mode';
7575

7676

7777
classLineParser{

‎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
vartype=typeofvalue;
461461

462462
if(type==='string'){
463-
varsimple='\''+JSON.stringify(value).replace(/^"|"$/g,'')
464-
.replace(/'/g,"\\'")
465-
.replace(/\\"/g,'"')+'\'';
463+
varsimple='\''+
464+
JSON.stringify(value)
465+
.replace(/^"|"$/g,'')
466+
.replace(/'/g,"\\'")
467+
.replace(/\\"/g,'"')+
468+
'\'';
466469
returnctx.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
constutil=require('util');
77
constassert=require('assert').ok;
88
constkMaxLength=require('buffer').kMaxLength;
9-
constkRangeErrorMessage='Cannot create final Buffer. '+
10-
'It would be larger than 0x'+kMaxLength.toString(16)+' bytes.';
9+
constkRangeErrorMessage='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
constquote='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
constexpected='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
letb=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
constexpectedWhite=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
constexpectedIllegal=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
constquote='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
constexpected='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,(newBuffer(quote)).toString('base64'));
548548

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

554554
// check that the base64 decoder ignores whitespace
555555
constexpectedWhite=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=newBuffer(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
constexpectedIllegal=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=newBuffer(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
constexpected=expected_results[k];
108108

109109
varmsg=(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
constexpected=expected_results[k];
9191

9292
varmsg=(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',functiononExit(exitCode,signal){
162162
consterrMsg='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
functionerrExec(script,callback){
1010
varcmd='"'+process.argv[0]+'" "'+
11-
path.join(common.fixturesDir,script)+'"';
11+
path.join(common.fixturesDir,script)+'"';
1212
returnexec(cmd,function(err,stdout,stderr){
1313
// There was some error
1414
assert.ok(err);

0 commit comments

Comments
 (0)