Skip to content

Commit aaeeec4

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: #6869 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
1 parent 3745d84 commit aaeeec4

22 files changed

+158
-144
lines changed

lib/child_process.js

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

460460
if (!err) {
461-
var msg = 'Command failed: ' +
462-
(ret.cmd ? ret.cmd : ret.args.join(' ')) +
463-
(ret.stderr ? '\n' + ret.stderr.toString() : '');
461+
var msg = 'Command failed: ';
462+
msg += ret.cmd || ret.args.join(' ');
463+
if (ret.stderr)
464+
msg += '\n' + ret.stderr.toString();
464465
err = new Error(msg);
465466
}
466467

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
@@ -426,9 +426,12 @@ function formatPrimitive(ctx, value) {
426426
var type = typeof value;
427427

428428
if (type === 'string') {
429-
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
430-
.replace(/'/g, "\\'")
431-
.replace(/\\"/g, '"') + '\'';
429+
var simple = '\'' +
430+
JSON.stringify(value)
431+
.replace(/^"|"$/g, '')
432+
.replace(/'/g, "\\'")
433+
.replace(/\\"/g, '"') +
434+
'\'';
432435
return ctx.stylize(simple, 'string');
433436
}
434437
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.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -464,17 +464,17 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
464464
{
465465
// big example
466466
const quote = 'Man is distinguished, not only by his reason, but by this ' +
467-
'singular passion from other animals, which is a lust ' +
468-
'of the mind, that by a perseverance of delight in the ' +
469-
'continued and indefatigable generation of knowledge, exceeds ' +
470-
'the short vehemence of any carnal pleasure.';
467+
'singular passion from other animals, which is a lust ' +
468+
'of the mind, that by a perseverance of delight in the ' +
469+
'continued and indefatigable generation of knowledge, ' +
470+
'exceeds the short vehemence of any carnal pleasure.';
471471
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
472-
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh' +
473-
'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk' +
474-
'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG' +
475-
'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle' +
476-
'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh' +
477-
'c3VyZS4=';
472+
'24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci' +
473+
'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ' +
474+
'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu' +
475+
'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' +
476+
'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' +
477+
'5hbCBwbGVhc3VyZS4=';
478478
assert.equal(expected, (new Buffer(quote)).toString('base64'));
479479

480480
let b = new Buffer(1024);
@@ -484,11 +484,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
484484

485485
// check that the base64 decoder ignores whitespace
486486
const expectedWhite = expected.slice(0, 60) + ' \n' +
487-
expected.slice(60, 120) + ' \n' +
488-
expected.slice(120, 180) + ' \n' +
489-
expected.slice(180, 240) + ' \n' +
490-
expected.slice(240, 300) + '\n' +
491-
expected.slice(300, 360) + '\n';
487+
expected.slice(60, 120) + ' \n' +
488+
expected.slice(120, 180) + ' \n' +
489+
expected.slice(180, 240) + ' \n' +
490+
expected.slice(240, 300) + '\n' +
491+
expected.slice(300, 360) + '\n';
492492
b = new Buffer(1024);
493493
bytesWritten = b.write(expectedWhite, 0, 'base64');
494494
assert.equal(quote.length, bytesWritten);
@@ -502,11 +502,11 @@ assert.equal('TWFu', (new Buffer('Man')).toString('base64'));
502502

503503
// check that the base64 decoder ignores illegal chars
504504
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
505-
expected.slice(60, 120) + ' \xff' +
506-
expected.slice(120, 180) + ' \x00' +
507-
expected.slice(180, 240) + ' \x98' +
508-
expected.slice(240, 300) + '\x03' +
509-
expected.slice(300, 360);
505+
expected.slice(60, 120) + ' \xff' +
506+
expected.slice(120, 180) + ' \x00' +
507+
expected.slice(180, 240) + ' \x98' +
508+
expected.slice(240, 300) + '\x03' +
509+
expected.slice(300, 360);
510510
b = new Buffer(expectedIllegal, 'base64');
511511
assert.equal(quote.length, b.length);
512512
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
@@ -182,8 +182,8 @@ if (process.argv[2] === 'child') {
182182

183183
child.on('exit', function onExit(exitCode, signal) {
184184
const errMsg = 'Test at index ' + testIndex + ' should have aborted ' +
185-
'but instead exited with exit code ' + exitCode + ' and signal ' +
186-
signal;
185+
'but instead exited with exit code ' + exitCode +
186+
' and signal ' + signal;
187187
assert(common.nodeProcessAborted(exitCode, signal), errMsg);
188188
});
189189
});

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);

test/parallel/test-fs-append-file-sync.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ var currentFileData = 'ABCD';
88

99
var num = 220;
1010
var data = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' +
11-
'广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' +
12-
'南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' +
13-
'前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' +
14-
'南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' +
15-
'历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' +
16-
'它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n';
11+
'广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' +
12+
'南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' +
13+
'前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' +
14+
'南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' +
15+
'历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' +
16+
'它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n';
1717

1818
common.refreshTmpDir();
1919

0 commit comments

Comments
 (0)