Skip to content
Permalink
Browse files

benchmark,doc,lib,test: prepare for padding lint rule

Upcoming lint rule will require a blank line between consecutive
functions. Add it in the places where we don't have it already.

PR-URL: #30696
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Nov 28, 2019
1 parent 5334f59 commit da0c6736d02d31700f181aedc8b33bdb58503aa7
@@ -13,16 +13,19 @@ function main({ n }) {
if (j === n)
bench.end(n);
}

function cb2(arg1, arg2) {
j++;
if (j === n)
bench.end(n);
}

function cb3(arg1, arg2, arg3) {
j++;
if (j === n)
bench.end(n);
}

function cb4(arg1, arg2, arg3, arg4) {
j++;
if (j === n)
@@ -20,6 +20,7 @@ function main({ n }) {
} else
bench.end(n);
}

function cb3(arg1, arg2, arg3) {
if (--counter) {
if (counter % 4 === 0)
@@ -33,6 +34,7 @@ function main({ n }) {
} else
bench.end(n);
}

function cb2(arg1, arg2) {
if (--counter) {
if (counter % 4 === 0)
@@ -46,6 +48,7 @@ function main({ n }) {
} else
bench.end(n);
}

function cb1(arg1) {
if (--counter) {
if (counter % 4 === 0)
@@ -12,7 +12,9 @@ function main({ n }) {
});

function cb1(arg1) {}

function cb2(arg1, arg2) {}

function cb3(arg1, arg2, arg3) {}

bench.start();
@@ -21,6 +21,7 @@ function main({ n }) {
setImmediate(cb1, n);
}
}

function cb2(n, arg2) {
if (--n) {
if (n % 3 === 0)
@@ -31,6 +32,7 @@ function main({ n }) {
setImmediate(cb1, n);
}
}

function cb1(n) {
if (--n) {
if (n % 3 === 0)
@@ -12,16 +12,19 @@ function main({ n }) {
if (j === n)
bench.end(n);
}

function cb2(arg1, arg2) {
j++;
if (j === n)
bench.end(n);
}

function cb3(arg1, arg2, arg3) {
j++;
if (j === n)
bench.end(n);
}

function cb4(arg1, arg2, arg3, arg4) {
j++;
if (j === n)
@@ -19,9 +19,11 @@ function main({ n }) {
function cb() {
process.nextTick(counter);
}

function cb2() {
process.nextTick(counter);
}

function counter() {
count++;
if (count === n)
@@ -20,6 +20,7 @@ function main({ n }) {
if (count === n)
bench.end(n);
}

function cb2() {
count++;
if (count === n)
@@ -20,6 +20,7 @@ function main({ n }) {
if (count === n)
bench.end(n);
}

function cb2() {
count++;
if (count === n)
@@ -1256,9 +1256,11 @@ a string as the second argument gets considered:
function throwingFirst() {
throw new Error('First');
}
function throwingSecond() {
throw new Error('Second');
}
function notThrowing() {}
// The second argument is a string and the input function threw an Error.
@@ -623,6 +623,7 @@ function needFinish(state) {
!state.finished &&
!state.writing);
}

function callFinal(stream, state) {
stream._final((err) => {
state.pendingcb--;
@@ -634,6 +635,7 @@ function callFinal(stream, state) {
finishMaybe(stream, state);
});
}

function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === 'function' && !state.destroyed) {
@@ -7,6 +7,7 @@ function lazyError() {
}
return error;
}

function assert(value, message) {
if (!value) {
const ERR_INTERNAL_ASSERTION = lazyError();
@@ -14,9 +14,13 @@ const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest');
const kPendingShutdownRequest = Symbol('kPendingShutdownRequest');

function isClosing() { return this[owner_symbol].isClosing(); }

function onreadstart() { return this[owner_symbol].readStart(); }

function onreadstop() { return this[owner_symbol].readStop(); }

function onshutdown(req) { return this[owner_symbol].doShutdown(req); }

function onwrite(req, bufs) { return this[owner_symbol].doWrite(req, bufs); }

/* This class serves as a wrapper for when the C++ side of Node wants access
@@ -46,6 +46,7 @@ const kHasTickScheduled = 0;
function hasTickScheduled() {
return tickInfo[kHasTickScheduled] === 1;
}

function setHasTickScheduled(value) {
tickInfo[kHasTickScheduled] = value ? 1 : 0;
}
@@ -16,6 +16,7 @@ function lazyWorkerStdio() {
if (!workerStdio) workerStdio = createWorkerStdio();
return workerStdio;
}

function createStdioGetters() {
return {
getStdout() { return lazyWorkerStdio().stdout; },
@@ -259,6 +259,7 @@ function REPLServer(prompt,
function pause() {
paused = true;
}

function unpause() {
if (!paused) return;
paused = false;
@@ -5,6 +5,7 @@ const assert = require('assert');
function createURL(mime, body) {
return `data:${mime},${body}`;
}

function createBase64URL(mime, body) {
return `data:${mime};base64,${Buffer.from(body).toString('base64')}`;
}
@@ -26,10 +26,13 @@ const assert = require('assert');
const events = require('events');

function listener() {}

function listener2() {}

function listener3() {
return 0;
}

function listener4() {
return 1;
}
@@ -25,6 +25,7 @@ const assert = require('assert');
const EventEmitter = require('events');

function listener1() {}

function listener2() {}

{
@@ -490,6 +490,7 @@ function test_abs_with_kids(realpath, realpathSync, cb) {
try { fs.rmdirSync(root + folder); } catch {}
});
}

function setup() {
cleanup();
['',
@@ -27,6 +27,7 @@ function asyncLoop(fn, times, cb) {
}
});
}

function makeKeepAliveRequest(cb) {
http.get({
socketPath: common.PIPE,
@@ -62,6 +62,7 @@ assert.strictEqual(r1.useColors, r1.rli.terminal);

// 2
function writer() {}

function evaler() {}
const r2 = repl.start({
input: stream,
@@ -12,6 +12,7 @@ const expected = 'asdf';
function _transform(d, e, n) {
n();
}

function _flush(n) {
n(null, expected);
}
@@ -68,6 +68,7 @@ server.listen(0, function() {
process.exit(0);
write();
}

function write() {
// This needs to return false eventually
while (false !== conn.write(chunk));
@@ -26,6 +26,7 @@ const stat = promisify(fs.stat);

{
function fn() {}

function promisifedFn() {}
fn[promisify.custom] = promisifedFn;
assert.strictEqual(promisify(fn), promisifedFn);
@@ -89,6 +89,7 @@ assert.throws(
fs.unwatchFile(filepathTwo, a);
++watchSeenTwo;
}

function b() {
fs.unwatchFile(filepathTwo, b);
++watchSeenTwo;
@@ -205,6 +205,7 @@ function testRunnerMain() {
});
});
}

function masterProcessMain() {
const workers = JSON.parse(process.env.workers);
const clusterSettings = JSON.parse(process.env.clusterSettings) || {};

0 comments on commit da0c673

Please sign in to comment.
You can’t perform that action at this time.