Skip to content
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

build: run linter before running tests #16284

Closed
wants to merge 1 commit into from

Conversation

joyeecheung
Copy link
Member

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

build, test

Fixes: #16283

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Oct 18, 2017
@joyeecheung
Copy link
Member Author

@joyeecheung
Copy link
Member Author

cc @nodejs/testing

@Trott
Copy link
Member

Trott commented Oct 18, 2017

A bit of probably-relevant back-story: I made this change over a year ago in d9f7a59 and people hated it enough that I felt compelled to revert it in #5602.

I like it, though. +1 from me!

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Maybe the thing to do to make everyone happy is put the linter into a test file so it can run in parallel with other tests. :-D I'm just joking. OR AM I?!?!

@Trott
Copy link
Member

Trott commented Oct 18, 2017

Another option, if people do object to this, might be to make it somehow configurable or have a task separate from make test that has this ordering.

@gibfahn
Copy link
Member

gibfahn commented Oct 18, 2017

Great idea! Should make things easier for new contributors too (number of people running make test and finding linter errors at the end at code-and-learn was large).

@joyeecheung
Copy link
Member Author

Looking at #5470 cc @bnoordhuis @Fishrock123

I am thinking maybe we can have two targets

  • make test-only for running tests (better for people who are familiar with our process)
  • make test for running lint + tests (better for new contributors)

Doesn't have to be these two, any suggestions are welcomed. (I wouldn't even object to make t because hey, less typing)

@vsemozhetbyt vsemozhetbyt added the tools Issues and PRs related to the tools directory. label Oct 18, 2017
@refack
Copy link
Contributor

refack commented Oct 18, 2017

LGTM. Maybe the thing to do to make everyone happy is put the linter into a test file so it can run in parallel with other tests. :-D I'm just joking. OR AM I?!?!

I like the "linter as test" idea (or some other way to make lint not stop the rest of the make), since it will allow to get both outputs with a single run.

@gibfahn
Copy link
Member

gibfahn commented Oct 18, 2017

I am thinking maybe we can have two targets

  • make test-only for running tests (better for people who are familiar with our process)
  • make test for running lint + tests (better for new contributors)

Something like this seems like it would resolve @bnoordhuis 's objection to the previous PR, while making new contributor's lives easier.

(I wouldn't even object to make t because hey, less typing)

I like make t, it's not obvious, but then this isn't something people getting started are likely to need.

@jasnell
Copy link
Member

jasnell commented Oct 18, 2017

Another possible color for the bikeshed: A ./configure --lint-first type of option may be worthwhile... that is, some configuration option that would instruct the Makefile to run linting first.

@joyeecheung
Copy link
Member Author

@jasnell That works as well but I think the default should be lint-first instead? Also this could require some hack because the main Makefile is not actually generated...

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhdawson
Copy link
Member

How about "test-no-lint" for the target that does everything except for the linter ? But no strong feeling, just another suggestion to consider.

Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The make t & make test suggestion seems good to me, FWIW.

@joyeecheung
Copy link
Member Author

joyeecheung commented Oct 19, 2017

Rebased and implemented make t for people who just want a quick check. @apapirovski @refack @Trott @lpinca @BridgeAR @mhdawson @gibfahn Can people who approved before take another look please? Thanks!

Also @bnoordhuis do you still object to this idea? Although we can always revert if we hate it ¯\(ツ)

CI: https://ci.nodejs.org/job/node-test-pull-request/10845/

Makefile Outdated
endif

# For a quick test, does not run linter or build doc
t: all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does t need to be added to .PHONY?

Makefile Outdated
endif

# For a quick test, does not run linter or build doc
t: all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t is a terrible name for a make target (that what it does has to be described in a comment is a good indicator that it is badly named). We're already at 40+ phony targets -- It should be in our interest that the target names be reasonably self descriptive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this isn't something most people will want to use. It looks like a shortcut, which is what it is.

Copy link
Contributor

@Fishrock123 Fishrock123 Oct 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer test-only, personally... I think anyways. Maybe not.
¯\_(ツ)_/¯

Copy link
Member

@tniessen tniessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically LGTM, but I would prefer not to use single-character target names.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'd prefer a more descriptive name but don't want to bikeshed so I'm ok with that everybody else agrees to.

@joyeecheung
Copy link
Member Author

joyeecheung commented Oct 19, 2017

@richardlau @tniessen @mhdawson Yeah...took the name because it's meant to be a shortcut, couldn't think of anything better at that point. How about make check?

@joyeecheung
Copy link
Member Author

Landed in 2875459, thanks!

joyeecheung added a commit that referenced this pull request Oct 29, 2017
PR-URL: #16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
PR-URL: #16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
PR-URL: #16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@gibfahn gibfahn mentioned this pull request Oct 31, 2017
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
PR-URL: nodejs/node#16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
PR-URL: nodejs/node#16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@MylesBorins
Copy link
Contributor

This doesn't land cleanly on v6.x-staging can someone manually backport?

@joyeecheung joyeecheung self-assigned this Nov 17, 2017
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#16284
Fixes: https://github.com/node/issues/16283
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run linters before running tests?