New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test,lib,benchmark: match function names #9113

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@Trott
Member

Trott commented Oct 15, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test lib benchmark

Description of change

In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.
@targos

I don't mind the changes. +0 on activating the rule.

@@ -340,10 +340,10 @@ TLSSocket.prototype._wrapHandle = function(wrap) {
res._secureContext = context;
res.reading = handle.reading;
Object.defineProperty(handle, 'reading', {
get: function readingGetter() {
get: function get() {

This comment has been minimized.

@targos

targos Oct 16, 2016

Member

What about using get() { ?

This comment has been minimized.

@Trott

Trott Oct 18, 2016

Member

I find that confusing to read. I will probably change my opinion as it becomes more common and I get used to seeing it. If there's a strong preference for it among others, I'll use it. But if left to my own devices, I prefer the explicit key: value format instead.

return res.reading;
},
set: function readingSetter(value) {
set: function set(value) {

This comment has been minimized.

@targos

targos Oct 16, 2016

Member

Ditto

cb();
};
s.destroy = s.destroySoon = function destroy() {
s.destroy = s.destroySoon = function destroySoon() {

This comment has been minimized.

@targos

targos Oct 16, 2016

Member

This one is ambiguous. I would keep destroy if I had the choice. Did ESLint complain?
Anyway that's fine. It's just a test...

This comment has been minimized.

@Trott

Trott Oct 18, 2016

Member

Yeah, ESLint wanted it to be destroySoon. I agree that destroy is probably preferable, I'll switch it back.

@@ -166,7 +166,7 @@ const tests = [
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
},
{ // Make sure this is always the last test, since we change os.homedir()
before: function mockHomedirFailure() {
before: function before() {

This comment has been minimized.

@targos

targos Oct 16, 2016

Member

Nit: shorthand syntax

@@ -291,7 +291,7 @@ const testCustomCompleterSyncMode = repl.start({
prompt: '',
input: putIn,
output: putIn,
completer: function completerSyncMode(line) {
completer: function completer(line) {

This comment has been minimized.

@targos

targos Oct 16, 2016

Member

Ditto here and on line 326.

@jasnell

LGTM

@lpinca lpinca referenced this pull request Oct 17, 2016

Closed

stream: name anonymous functions #9130

2 of 2 tasks complete
@Trott

This comment has been minimized.

@rvagg rvagg force-pushed the nodejs:master branch 2 times, most recently to 83c7a88 Oct 18, 2016

@Trott

This comment has been minimized.

Member

Trott commented Oct 18, 2016

@Trott

This comment has been minimized.

Member

Trott commented Oct 20, 2016

One more CI for good measure: https://ci.nodejs.org/job/node-test-commit/5698/

Only red in that one is a build failure on a Raspberry Pi.

Trott added a commit to Trott/io.js that referenced this pull request Oct 20, 2016

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: nodejs#9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@Trott

This comment has been minimized.

Member

Trott commented Oct 20, 2016

Landed in 68ba9aa

@Trott Trott closed this Oct 20, 2016

jasnell added a commit that referenced this pull request Oct 20, 2016

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: #9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>

MylesBorins added a commit that referenced this pull request Nov 15, 2016

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: #9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins

This comment has been minimized.

Member

MylesBorins commented Nov 15, 2016

hey @Trott I've backported this to both v6 and v4 in 7b75cb9 and bd99b2d respectively.

The v4 change had some conflicts, specifically in files where you changes touched stuff that didn't exist in the tree.

I'm under the impression we would want this work backported, please let me know if we should revert.

@MylesBorins

This comment has been minimized.

Member

MylesBorins commented Nov 22, 2016

it seems this backport did not happen on v4.x @Trott should we backport?

@MylesBorins MylesBorins referenced this pull request Nov 22, 2016

Merged

v6.9.2 proposal #9735

@Trott

This comment has been minimized.

Member

Trott commented Nov 22, 2016

it seems this backport did not happen on v4.x @Trott should we backport?

I'd prefer that we do, yes.

@MylesBorins

This comment has been minimized.

Member

MylesBorins commented Dec 21, 2016

@Trott would you be willing to backport to v4.x?

Trott added a commit to Trott/io.js that referenced this pull request Dec 21, 2016

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: nodejs#9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@Trott

This comment has been minimized.

Member

Trott commented Dec 21, 2016

Trott added a commit that referenced this pull request Jan 4, 2017

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: #9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>

MylesBorins added a commit that referenced this pull request Jan 5, 2017

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: #9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>

MylesBorins added a commit that referenced this pull request Jan 24, 2017

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: #9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>

@MylesBorins MylesBorins referenced this pull request Jan 24, 2017

Merged

v4.8.0 proposal #10973

MylesBorins added a commit that referenced this pull request Feb 1, 2017

test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: #9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment