-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: documentation of sync methods links now to async methods #21243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! There are some nits we need to fix)
doc/api/fs.md
Outdated
@@ -1826,6 +1830,8 @@ added: v0.8.6 | |||
|
|||
Synchronous ftruncate(2). Returns `undefined`. | |||
|
|||
For detailed information, see the documentation of [`fs.ftruncate()`][]. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
doc/api/fs.md
Outdated
@@ -2867,6 +2883,8 @@ changes: | |||
|
|||
Synchronous symlink(2). Returns `undefined`. | |||
|
|||
For detailed information, see the documentation of [`fs.symlink()`][]. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
doc/api/fs.md
Outdated
@@ -1143,6 +1143,8 @@ changes: | |||
Synchronously changes the permissions of a file. Returns `undefined`. | |||
This is the synchronous version of [`fs.chmod()`][]. | |||
|
|||
For detailed information, see the documentation of [`fs.chmod()`][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessary given the immediately previous sentence.
doc/api/fs.md
Outdated
@@ -1573,6 +1575,8 @@ changes: | |||
Synchronous version of [`fs.exists()`][]. | |||
Returns `true` if the path exists, `false` otherwise. | |||
|
|||
For detailed information, see the documentation of [`fs.exists()`][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would greatly prefer we stick with the wording used elsewhere:
This is the synchronous version of [`fs.exists()`][].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of these contain links we should definitely add while many others of these changes also seem to add unnecessary sentences, as they often repeat the information in the sentence that comes right before them.
Hi, @iwko! Welcome, and thanks for the pull request! Documentation changes can often attract a lot of review comments. I hope you'll be patient and not be discouraged. Thanks! |
cc @joyeecheung to chime in. |
Also I was confused when I got started with fs documentation as well. There are no clear indications that you should click the link to find out more information e.g. about what the arguments actually mean. Just listing arguments without any explanation following by Maybe a better way to fix this would be instead of saying
But I guess the point of saying |
@joyeecheung Something like that would make sense to me. But given what you wrote, I guess the current version of this is still an improvement. I'll remove my request for changes. This can always be iterated on going forward. @nodejs/documentation |
So, should I change my changes to |
I would say yes, but let's see what other people from @nodejs/fs @nodejs/documentation think. With that style we will lose the emphasis on making the async versions the perferred APIs. |
How should we proceed? |
I hate to do this but this is more than a week old and has attracted very little attention from @nodejs/documentation so I'm going to do the dreaded @nodejs/collaborators... |
The text LGTM as is |
@iwko Thank you for this PR! Here are some comments.
We could prefix this document with "The asynchronous version of APIs documents parameters. The synchronous version indicates only the return value and exceptional behavior.". That would only help someone who bothers to read the complete document though. I would prefer merging the two into a single sentence as @Trott proposed: "For detailed information, see the documentation of the asynchronous version of this API:
|
@joyeecheung Sure thing |
@joyeecheung done |
doc/api/fs.md
Outdated
@@ -1143,6 +1143,9 @@ changes: | |||
Synchronously changes the permissions of a file. Returns `undefined`. | |||
This is the synchronous version of [`fs.chmod()`][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little confused now. So documentation for fs.chmod()
should look like this?
Synchronously changes the permissions of a file. Returns undefined. For detailed information, see the documentation of the asynchronous version of this API: [fs.chmod()][]. See also: chmod(2).
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iwko Yes, that's my understanding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joyeecheung done
I've done all changes. What do You think? @vsemozhetbyt @Trott @davisjam @joyeecheung |
@iwko I will have time to look today or tomorrow. |
doc/api/fs.md
Outdated
@@ -1140,8 +1140,10 @@ changes: | |||
* `path` {string|Buffer|URL} | |||
* `mode` {integer} | |||
|
|||
Synchronously changes the permissions of a file. Returns `undefined`. | |||
This is the synchronous version of [`fs.chmod()`][]. | |||
Returns `undefined`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth to completely skip these notes? We usually do not state anything if a function returns undefined
.
doc/api/fs.md
Outdated
@@ -4589,6 +4621,7 @@ the file contents. | |||
[`fs.chown()`]: #fs_fs_chown_path_uid_gid_callback | |||
[`fs.copyFile()`]: #fs_fs_copyfile_src_dest_flags_callback | |||
[`fs.exists()`]: fs.html#fs_fs_exists_path_callback | |||
[`fs.ftruncate()`]: #fs_fs_ftruncate_fd_len_callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this one should go after the next reference, ABC-wise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
When this PR will be merged? |
@iwko Can you address the two nits from @vsemozhetbyt? Specifically, there's no need to indicate that Once that's done, we can run CI and probably land this promptly. (There may be an issue with the merge commit recently added to the branch. Our CI setup does not like merge commits, or at least didn't used to. But we'll deal with that when we get there.) |
@Trott I've made changes |
038be2d
to
9921a76
Compare
Looks like CI failed because of the merge commit. I've squashed out the merge commit. CI: https://ci.nodejs.org/job/node-test-pull-request-lite/906/ Would probably be good for people who have approved this to look it over again and make sure they still approve. I don't expect anyone to rescind their approval but this has nonetheless gone through substantial evolution. |
@vsemozhetbyt @joyeecheung @davisjam @TimothyGu @jasnell Are you still ok with those changes? |
Still LGTM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add links to async methods and make wording consistent. PR-URL: nodejs#21243 Refs: nodejs#21197 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Jamie Davis <davisjam@vt.edu> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Landed in 65208d0. Thanks for the contribution! 🎉 |
Add links to async methods and make wording consistent. PR-URL: #21243 Refs: #21197 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Jamie Davis <davisjam@vt.edu> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Documentation of sync methods links now to async methods if it made sense
Checklist
Refs: #21197