Skip to content

Commit

Permalink
benchmark,doc,lib,test: prepare for padding lint rule
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Denys Otrishko <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
Trott authored and targos committed Dec 1, 2019
1 parent de3a1c3 commit 4cd4e7c
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions benchmark/process/next-tick-breadth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions benchmark/process/next-tick-depth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function main({ n }) {
} else
bench.end(n);
}

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

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

function cb1(arg1) {
if (--counter) {
if (counter % 4 === 0)
Expand Down
2 changes: 2 additions & 0 deletions benchmark/timers/set-immediate-breadth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ function main({ n }) {
});

function cb1(arg1) {}

function cb2(arg1, arg2) {}

function cb3(arg1, arg2, arg3) {}

bench.start();
Expand Down
2 changes: 2 additions & 0 deletions benchmark/timers/set-immediate-depth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function main({ n }) {
setImmediate(cb1, n);
}
}

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

function cb1(n) {
if (--n) {
if (n % 3 === 0)
Expand Down
3 changes: 3 additions & 0 deletions benchmark/timers/timers-breadth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions benchmark/timers/timers-timeout-nexttick.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ function main({ n }) {
function cb() {
process.nextTick(counter);
}

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

function counter() {
count++;
if (count === n)
Expand Down
1 change: 1 addition & 0 deletions benchmark/timers/timers-timeout-pooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function main({ n }) {
if (count === n)
bench.end(n);
}

function cb2() {
count++;
if (count === n)
Expand Down
1 change: 1 addition & 0 deletions benchmark/timers/timers-timeout-unpooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function main({ n }) {
if (count === n)
bench.end(n);
}

function cb2() {
count++;
if (count === n)
Expand Down
2 changes: 2 additions & 0 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -1266,9 +1266,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.
Expand Down
2 changes: 2 additions & 0 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ function needFinish(state) {
!state.finished &&
!state.writing);
}

function callFinal(stream, state) {
stream._final((err) => {
state.pendingcb--;
Expand All @@ -658,6 +659,7 @@ function callFinal(stream, state) {
}
});
}

function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === 'function' && !state.destroyed) {
Expand Down
1 change: 1 addition & 0 deletions lib/internal/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function lazyError() {
}
return error;
}

function assert(value, message) {
if (!value) {
const ERR_INTERNAL_ASSERTION = lazyError();
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/internal/process/task_queues.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const kHasTickScheduled = 0;
function hasTickScheduled() {
return tickInfo[kHasTickScheduled] === 1;
}

function setHasTickScheduled(value) {
tickInfo[kHasTickScheduled] = value ? 1 : 0;
}
Expand Down
1 change: 1 addition & 0 deletions lib/internal/process/worker_thread_only.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function lazyWorkerStdio() {
if (!workerStdio) workerStdio = createWorkerStdio();
return workerStdio;
}

function createStdioGetters() {
return {
getStdout() { return lazyWorkerStdio().stdout; },
Expand Down
1 change: 1 addition & 0 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ function REPLServer(prompt,
function pause() {
paused = true;
}

function unpause() {
if (!paused) return;
paused = false;
Expand Down
1 change: 1 addition & 0 deletions test/es-module/test-esm-data-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,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')}`;
}
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-event-emitter-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ const assert = require('assert');
const events = require('events');

function listener() {}

function listener2() {}

function listener3() {
return 0;
}

function listener4() {
return 1;
}
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-event-emitter-remove-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const assert = require('assert');
const EventEmitter = require('events');

function listener1() {}

function listener2() {}

{
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-fs-realpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ function test_abs_with_kids(realpath, realpathSync, cb) {
try { fs.rmdirSync(root + folder); } catch {}
});
}

function setup() {
cleanup();
['',
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-http-unix-socket-keep-alive.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function asyncLoop(fn, times, cb) {
}
});
}

function makeKeepAliveRequest(cb) {
http.get({
socketPath: common.PIPE,
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-repl-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ assert.strictEqual(r1.useColors, r1.rli.terminal);

// 2
function writer() {}

function evaler() {}
const r2 = repl.start({
input: stream,
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-stream-transform-flush-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const expected = 'asdf';
function _transform(d, e, n) {
n();
}

function _flush(n) {
n(null, expected);
}
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-tls-fast-writing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-util-promisify.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const stat = promisify(fs.stat);

{
function fn() {}

function promisifedFn() {}
fn[promisify.custom] = promisifedFn;
assert.strictEqual(promisify(fn), promisifedFn);
Expand Down
1 change: 1 addition & 0 deletions test/pummel/test-fs-watch-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ assert.throws(
fs.unwatchFile(filepathTwo, a);
++watchSeenTwo;
}

function b() {
fs.unwatchFile(filepathTwo, b);
++watchSeenTwo;
Expand Down
1 change: 1 addition & 0 deletions test/sequential/test-inspector-port-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function testRunnerMain() {
});
});
}

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

0 comments on commit 4cd4e7c

Please sign in to comment.