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

Add JSdocs comments to improve readability in the codebase. #2279

Open
Bruce-Hopkins opened this issue Mar 17, 2022 · 3 comments
Open

Add JSdocs comments to improve readability in the codebase. #2279

Bruce-Hopkins opened this issue Mar 17, 2022 · 3 comments

Comments

@Bruce-Hopkins
Copy link
Contributor

What version of this package are you using?
1.8.6

What problem do you want to solve?
In #2222 it was mentioned that the codebase doesn't have functions and methods don't have comments for documentation.

I've found the codebase hard to get my head around, especially since functions aren't commented so it's hard to know what they are intended to do, and therefore how to fix them without breaking something.

I've found the same issue when adding my own contributions to the codebase. I believe that the code can benefit from JSdocs style comments to the classes for both contributors and users.

What do you think is the correct solution to this problem?
To add JSdocs style documentation to all (or most) of the functions and methods in the codebase.

Are you willing to submit a pull request to implement this change?
Gladly!

@DiegoRBaquero
Copy link
Member

I'd be happy to have code docs! If you are up for it, I'm happy to review

@Bruce-Hopkins
Copy link
Contributor Author

Thanks! I'll get started on it.

@Bruce-Hopkins
Copy link
Contributor Author

@DiegoRBaquero I'm currently working on the PR to implement more docs but I'm not sure which methods I should document,

I noticed a common pattern in the codebase. Many of the methods which start with underscores don't have jsdocs styles comments for them:

_destroy (err, cb) {

While the ones without underscores do:

webtorrent/index.js

Lines 468 to 472 in 38a6c72

/**
* Destroy the client, including all torrents and connections to peers.
* @param {function} cb
*/
destroy (cb) {

Is there a reason for this? Should I add comments to both?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants