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

Standardize and improve docstring #562

Merged
merged 11 commits into from
Aug 31, 2022
Merged

Standardize and improve docstring #562

merged 11 commits into from
Aug 31, 2022

Conversation

jamestiotio
Copy link
Contributor

@jamestiotio jamestiotio commented Aug 27, 2022

Public API Changes
The refactoring to core/Ros.js might break some applications. However, the proposed changes would make the public API more straightforward in two ways:

  • The implementation code is now aligned with the public API as specified in the docstring. I feel that this is important to minimize possible future confusion over the differences between the API described in the docstring versus the actual implementation.
  • For the getNodeDetails method, the callback function signature now remains the same, whether there is a failedCallback function defined or not. Previously, the function signature differs between the two, which might lead to further confusion.

Description
This PR standardizes and improves the docstring, along with a few other small things.

More specifically, this PR does the following (in rough order of significance):

  • Add parameter and return types to docstrings.
  • Add proper indication of optional parameters to the relevant docstrings.
  • Rephrase some docstrings to make them clearer.
  • Fix some typos in the docstring.
  • Add proper capitalization to docstring.
  • Method docstrings that start with a verb are standardized to use verbs without the -s suffix.

Additionally, there are some non-docstring changes (again, in rough order of significance):

  • Slightly refactor core/Ros.js to align the callback parameters with the ones specified in the corresponding docstrings. Tests are also updated to follow the new callback function signatures.
  • Align the parameter names of the methods setSucceeded, setAborted, and sendFeedback in actionlib/SimpleActionServer.js with the respective docstrings.
  • Remove dead code in actionlib/ActionListener.js (the options timeout, omitFeedback, omitStatus, and omitResult are not used there).
  • Lint some unnecessary whitespace lines in actionlib/SimpleActionServer.js and core/SocketAdapter.js.

Relevant GitHub issues:
This PR closes #542.

- Fix typos
- For method JSDoc starting with a verb, standardize the verbs to be without the `-s` suffix
- Add proper capitalization to JSDoc
- Rephrase some JSDoc to make it clearer
- Add parameter and return types to JSDoc
- Add proper indication of optional parameters to JSDoc
Copy link
Contributor

@Rayman Rayman left a comment

Choose a reason for hiding this comment

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

Breaking public API is for me a no-no. It means that every roslib application that has ever been made must now be upgraded.

Standardize and improve docstrings is very welcome. Maybe you could split your PR in 2?

@MatthijsBurgh
Copy link
Contributor

@jamestiotio Thanks for your efforts. Like @Rayman said the changes in the documentation is very welcome.

I think any breaking change is not accepted. As I don't plan any major version bump any time soon (and not so soon as well).

@jamestiotio
Copy link
Contributor Author

Breaking public API is for me a no-no.

Understood. In that case, I have reverted the breaking changes. Essentially, I have aligned the docstrings to simply follow the implementation as the source of truth.

To avoid confusion, I used the @also tag for the getNodeDetails method in core/Ros.js to specify the two different possible callback function signatures. Do let me know if there is a better way to handle this.

@MatthijsBurgh
Copy link
Contributor

Please cherry-pick 605ef08 in your branch. Than we are good to go.

Thanks for your efforts.

@jamestiotio
Copy link
Contributor Author

@MatthijsBurgh Commit has been cherry-picked.

Copy link
Contributor

@MatthijsBurgh MatthijsBurgh left a comment

Choose a reason for hiding this comment

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

Some changes related optional/default values

src/core/Topic.js Outdated Show resolved Hide resolved
src/math/Quaternion.js Outdated Show resolved Hide resolved
src/math/Vector3.js Outdated Show resolved Hide resolved
src/tf/TFClient.js Outdated Show resolved Hide resolved
src/tf/TFClient.js Outdated Show resolved Hide resolved
src/tf/TFClient.js Outdated Show resolved Hide resolved
src/tf/TFClient.js Outdated Show resolved Hide resolved
src/core/Ros.js Outdated Show resolved Hide resolved
src/core/Ros.js Outdated Show resolved Hide resolved
src/core/Ros.js Outdated Show resolved Hide resolved
jamestiotio and others added 2 commits August 31, 2022 19:29
Co-authored-by: Matthijs van der Burgh <matthijs.vander.burgh@live.nl>
@MatthijsBurgh MatthijsBurgh merged commit 4519171 into RobotWebTools:develop Aug 31, 2022
k-aguete pushed a commit to k-aguete/roslibjs that referenced this pull request Oct 21, 2022
…#562)

Bumps [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/HEAD/packages/node-resolve) from 13.3.0 to 14.1.0.
- [Release notes](https://github.com/rollup/plugins/releases)
- [Changelog](https://github.com/rollup/plugins/blob/master/packages/node-resolve/CHANGELOG.md)
- [Commits](https://github.com/rollup/plugins/commits/node-resolve-v14.1.0/packages/node-resolve)

---
updated-dependencies:
- dependency-name: "@rollup/plugin-node-resolve"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
MatthijsBurgh added a commit that referenced this pull request Dec 4, 2023
* Standardize JSDoc format and add proper types to JSDoc

- Fix typos
- For method JSDoc starting with a verb, standardize the verbs to be without the `-s` suffix
- Add proper capitalization to JSDoc
- Rephrase some JSDoc to make it clearer
- Add parameter and return types to JSDoc
- Add proper indication of optional parameters to JSDoc

* Remove dead code in ActionListener

* Lint whitespace and align ActionServer param name with JSDoc

* Refactor Ros.js to align callback parameters with JSDoc

* Update check-topics tests

* Fix check-topics example test

* Revert breaking changes and align docstring to impl as source of truth

* Remove 'An object with the following keys'

* Specify default param values explicitly in docstring

Co-authored-by: Matthijs van der Burgh <matthijs.vander.burgh@live.nl>

* Fix typos

* Specify more default param values

Co-authored-by: Matthijs van der Burgh <MatthijsBurgh@outlook.com>
Co-authored-by: Matthijs van der Burgh <matthijs.vander.burgh@live.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert option object docstring
3 participants