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

cli: fix the misalinged text on "node --help" #10948

Merged
merged 1 commit into from
Jan 28, 2017

Conversation

aashil
Copy link
Contributor

@aashil aashil commented Jan 22, 2017

The alignment of the argument descriptions in the "node --help"
text is off. This commit fixes the issue by adding two spaces
before each of the argument description.

Fixes: #10935

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

cli

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v7.x labels Jan 22, 2017
@mscdex mscdex added cli Issues and PRs related to the Node.js command line interface. and removed dont-land-on-v7.x labels Jan 22, 2017
@aashil aashil changed the title process: fix the misalinged text on "node --help" cli: fix the misalinged text on "node --help" Jan 22, 2017
@evanlucas
Copy link
Contributor

Thanks @aashil! Can you prefix the commit message with src: instead of cli: please?

@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2017

Does the --help menu currently enforce an 80 character limit? If so, does this cause any of the lines to go over that limit? If not, LGTM

@joshgav
Copy link
Contributor

joshgav commented Jan 23, 2017

LGTM - thanks!

@jasnell
Copy link
Member

jasnell commented Jan 23, 2017

Agree with @cjihrig's concern. If this causes any lines to go over 80, then that should be fixed. Otherwise LGTM

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

@evanlucas Sure, will do it.
@cjihrig Yes, it enforces the 80 line limit. I moved few words to confirm with the linter. All good. On a side not, why don't we have a test integration on Github which tests this automatically?

@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2017

On a side not, why don't we have a test integration on Github which tests this automatically?

Because you didn't write it yet! :-D

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

@cjihrig Can I help with setting it up? If yes, I would like to submit an issue and start working on it.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2017

I would just add a test to this PR. You can spawn node --help as a child process and validate the output.

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

I think we already have cpplint setup which tests for the 80 character limit here. From what I understand, the CI should automatically boot up the cpplint on submitting a PR. Please correct me if I am wrong.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2017

Linting would run on the source code. I was referring to the actual message printed to the console.

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

Ah, makes sense. Can you please point me to the file where I need to write the test ? Thank you.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 23, 2017

I would create a new test in test/message. Create a .js file that just runs node --help. The test output will be verified using a .out file, like the others in that directory.

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

Thanks. Will add the test soon.

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

@cjihrig I wrote a test as discussed but the test is reading the message from the node_help.out file with escape parameters while the child spawned process prints plain text(without escape parameters) to the process.stdout. Hence the comparison fails. Please look at the [WIP] commit I just pushed and the error log below for more clarity. Any suggestions about the escape parameters?

Error:

[00:01|%  33|+   8|-   0]: release node_help match failed  
line=0
expect=^Usage\:\ node\ \[options\]\ \[\ \-e\ script\ \|\ script\.js\ \]\ \[arguments\]$
actual=Usage: node [options] [ -e script | script.js ] [arguments] 

@Trott
Copy link
Member

Trott commented Jan 23, 2017

@aashil [arguments] has a space after it in the actual output that is not reflected in the node_help.out file. That is likely the source of the test failure. (The escaping you see is regular expression escaping and is likely not the problem.)

@aashil
Copy link
Contributor Author

aashil commented Jan 23, 2017

@Trott Added the space after it. Still the same error. This time I did node --help > test/message/node_help.out

#if HAVE_OPENSSL
" --tls-cipher-list=val use an alternative default TLS cipher "
" --tls-cipher-list=val use an alternative default TLS cipher "
"list\n"
" --use-bundled-ca use bundled CA store"
Copy link
Member

Choose a reason for hiding this comment

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

This and use-openssl-ca need to be aligned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@Trott
Copy link
Member

Trott commented Jan 26, 2017

@Trott Trott mentioned this pull request Jan 26, 2017
4 tasks
@aashil
Copy link
Contributor Author

aashil commented Jan 26, 2017

It appears that test/linux-fips expects the below two options in the .out file. Is there a workaround for this like the wildcard character? Not sure about test/arm test.

--enable-fips              enable FIPS crypto at startup
--force-fips               force FIPS crypto (cannot be disabled)

@Trott
Copy link
Member

Trott commented Jan 26, 2017

The ARM thing is just a problem with the GitHub widget. It's just the FIPS issue that we need to figure out.

As best as I can tell from looking at test/messages/testcfg.py with my limited Python knowledge, there's no way to have alternative outputs with different line counts. (Correction from someone more knowledgable would be welcome.)

So given that, it seems like the options are:

  • Move this out of messages and do the testing in parallel instead, which means reducing the amount of checking we're doing or else rewriting a lot of the messages test harness functionality in parallel.
  • Try to use messages.status to skip the test on FIPS (may require adding a feature to the test harness)
  • We can't use common.skip() in messages tests the way we can in other tests, so this isn't really an option but mentioning it here to pre-empt questions about it.
  • Find a way to strip out those two FIPS options lines in the test itself.

Looking at node.cc, though, there's all sorts of other options that are only printed conditionally such as crypto and Intl. Given that, I wonder if the first option (move to parallel) might be the way to go. Maybe instead of checking the whole usage message, you just check for a few basic things, like any late that starts with - also has whitespace followed by non-whitespace in whatever the column is where the text is aligned.

I'm not sure I'm communicating the idea clearly above, but that may be OK for now because I'm starting to wonder if trying to have the test be in this PR may be creating more problems than it's solving. Maybe we should strip it out of this and open a separate PR for it. Then the alignment fix for the usage text can land sooner and the test can take as much time as it takes. Normally, I'm not in favor of landing tests after functionality, but this isn't really functionality. It's formatting. I'm OK with the test coming later. We've gone this long without a test for it...

In case I'm missing an obvious solution that can easily be implemented, thus invalidating nearly everything I've written above: /cc @nodejs/testing

@Trott
Copy link
Member

Trott commented Jan 27, 2017

@aashil Is it OK with you if I land the alignment fix and we push the test issue to another PR?

@aashil
Copy link
Contributor Author

aashil commented Jan 27, 2017

Sure, Rich. I would like to work on the test issue PR as well. Will create a new PR in the weekend.

The alignment of the argument descriptions in the "node --help"
text is off. This commit fixes the issue by adding two spaces
before each of the argument description.

PR-URL: nodejs#10948
Fixes: nodejs#10935
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
@Trott
Copy link
Member

Trott commented Jan 28, 2017

Updated to just include changes to alignment in help message.

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

@Trott
Copy link
Member

Trott commented Jan 28, 2017

Landed in 5d27cc1.
Thanks for the contribution! 🎉

@Trott Trott closed this Jan 28, 2017
@Trott Trott merged commit 5d27cc1 into nodejs:master Jan 28, 2017
@evanlucas
Copy link
Contributor

This isn't landing cleanly on v7.x. Mind opening a backport pr targetting v7.x-staging?

@Trott
Copy link
Member

Trott commented Jan 31, 2017

@evanlucas Might be best to backport 6ff3b03 first.

@aashil
Copy link
Contributor Author

aashil commented Jan 31, 2017

I can backport both if you want.

@evanlucas
Copy link
Contributor

@aashil that would be awesome! Let us know if you have any questions on how to backport! Thanks!

@aashil
Copy link
Contributor Author

aashil commented Feb 1, 2017

From what I understand about backporting, first I need to create a branch off upstream/v7.x-staging and install the node version (7.x) in that branch. Thereafter, I need to make a copy of those commits (cherry-pick) and make sure it runs of v7.x. Just want to make sure I am on the right path.

joshgav pushed a commit to aashil/node that referenced this pull request Feb 7, 2017
The alignment of the argument descriptions in the "node --help"
text is off. This commit fixes the issue by adding two spaces
before each of the argument description.

PR-URL: nodejs#10948
Fixes: nodejs#10935
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 14, 2017
The alignment of the argument descriptions in the "node --help"
text is off. This commit fixes the issue by adding two spaces
before each of the argument description.

PR-URL: nodejs#10948
Fixes: nodejs#10935
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. cli Issues and PRs related to the Node.js command line interface.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli: misaligned node --help text
9 participants