AcademySoftwareFoundation / OpenTimelineIO

Open Source API and interchange format for editorial timeline information.
http://opentimeline.io
Apache License 2.0
1.4k stars 276 forks source link

Add Doxygen comments to RationalTime #1746

Closed darbyjohnston closed 2 weeks ago

darbyjohnston commented 1 month ago

Link the Issue(s) this Pull Request is related to.

Fixes #1753

Summarize your change.

Adds Doxygen comments to the RationalTime class. These comments are based on the Python doc strings with some editing for consistency. A couple of notes:

Here is a screenshot of the Doxygen comments providing help in Visual Studio:

OTIO Doxygen VS Tooltip

Here is a screenshot of the HTML generated for RationalTime:

OTIO Doxygen HTML

meshula commented 1 month ago

Overall this is a great improvement.

I'm not familiar with ABBREVIATE_BRIEF. Does it preclude documenting the parameters formally?

darbyjohnston commented 1 month ago

The ABBREVIATE_BRIEF option is a bit odd, it filters the text to try and make it more concise. So if your comment looks like this:

/// The Addition class provides functionality for adding numbers.

It will be changed to: "Functionality for adding numbers". I always find it a bit surprising so I like to turn it off.

If these changes look OK how should we go about documenting the rest of the code? It would be nice to do the work in chunks to keep it manageable, maybe one PR per class?

meshula commented 1 month ago

My first question about ABBREVIATE_BRIEF was really poking at whether that was supposed to do more, like infer parameters and returns.

I'd prefer we go heavy-handed with documentation, ie with full adornment. I assume ABBREVIATE_BRIEF means that we can skip the @brief tag. Sometimes this feels overboard, but I think it's better to be thorough and consistent in order that all the tooling around doxygen syntax can come into play. e.g. I just did a similar pass on Nanocolor, where everything is this heavy. Doing it this way allowed me to automate the decoration of the entire library using various tools in VsCode, so it wasn't as terrible as it seems. (Right click function, "Add doxygen comment", more or less)

/**
 * @brief Converts a XYZ color to RGB color space.
 * 
 * Converts a XYZ color to RGB color space using the provided color space.
 * 
 * @param cs Pointer to the color space object.
 * @param xyz The XYZ color to convert.
 * @return The RGB color.
 */
NCAPI NcRGB NcXYZToRGB(const NcColorSpace* cs, NcXYZ xyz);
darbyjohnston commented 1 month ago

The ABBREVIATE_BRIEF option doesn't do any inference, it's just for filtering text. To automate brief descriptions I was trying the options MULTILINE_CPP_IS_BRIEF=YES and REPEAT_BRIEF=YES, so a comment like this:

/// Converts a XYZ color to RGB color space. The conversion is performed
/// using the provided color space.

Will have the first sentence used for the brief description, and the entire text used for the full description.

I like the @param and @return keywords, though I wonder if we can omit them for simple functions, especially class member get methods?

meshula commented 1 month ago

Sure, why don't we have a look at that, it sounds fine to me.

darbyjohnston commented 1 month ago

After more testing the MULTILINE_CPP_IS_BRIEF option didn't work very well so I turned it off and added explicit @brief markup as you suggested.

I think the detailed description, @param markup, and @return markup should be optional since it adds a lot of boiler plate for simple functions like member get functions. They should just be used where necessary to provide extra information that isn't obvious from the function name.

Some other notes:

darbyjohnston commented 1 month ago

I created a new issue since the original Doxygen issue was closed awhile back. Given the amount of work maybe we can use the issue as an umbrella for multiple PRs: #1753

Any ideas on how to fix the CI build, the error doesn't seem related to this change?

meshula commented 1 month ago

The problem in the CI is that pip on windows under msys is failing because distlib can't be found. @reinecke does that ring any bells? I feel like we struggled through something like that last year but the details escape me.

darbyjohnston commented 1 month ago

Strange, it looks like distlib is being installed as part of the msys setup:

installing mingw-w64-x86_64-python-distlib...
codecov-commenter commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.71%. Comparing base (c0e97b0) to head (2723cf9). Report is 11 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746/graphs/tree.svg?width=650&height=150&src=pr&token=mfnfUB4h7u&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation)](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) ```diff @@ Coverage Diff @@ ## main #1746 +/- ## ========================================== - Coverage 84.11% 81.71% -2.41% ========================================== Files 198 176 -22 Lines 22241 12315 -9926 Branches 4687 3027 -1660 ========================================== - Hits 18709 10063 -8646 + Misses 2610 1713 -897 + Partials 922 539 -383 ``` | [Flag](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | Coverage Δ | | |---|---|---| | [py-unittests](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | `81.71% <100.00%> (-2.41%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | Coverage Δ | | |---|---|---| | [src/opentime/rationalTime.h](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=src%2Fopentime%2FrationalTime.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL29wZW50aW1lL3JhdGlvbmFsVGltZS5o) | `92.55% <ø> (-2.13%)` | :arrow_down: | | [src/opentimelineio/stackAlgorithm.cpp](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=src%2Fopentimelineio%2FstackAlgorithm.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL29wZW50aW1lbGluZWlvL3N0YWNrQWxnb3JpdGhtLmNwcA==) | `56.70% <100.00%> (ø)` | | | [...opentimelineio/opentimelineio/adapters/\_\_init\_\_.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=src%2Fpy-opentimelineio%2Fopentimelineio%2Fadapters%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lbGluZWlvL2FkYXB0ZXJzL19faW5pdF9fLnB5) | `85.18% <100.00%> (-2.32%)` | :arrow_down: | | [...timelineio/console/autogen\_plugin\_documentation.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=src%2Fpy-opentimelineio%2Fopentimelineio%2Fconsole%2Fautogen_plugin_documentation.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lbGluZWlvL2NvbnNvbGUvYXV0b2dlbl9wbHVnaW5fZG9jdW1lbnRhdGlvbi5weQ==) | `64.10% <ø> (-7.94%)` | :arrow_down: | | [.../py-opentimelineio/opentimelineio/core/\_\_init\_\_.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=src%2Fpy-opentimelineio%2Fopentimelineio%2Fcore%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lbGluZWlvL2NvcmUvX19pbml0X18ucHk=) | `83.01% <ø> (-0.32%)` | :arrow_down: | | [...-opentimelineio/opentimelineio/plugins/manifest.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=src%2Fpy-opentimelineio%2Fopentimelineio%2Fplugins%2Fmanifest.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lbGluZWlvL3BsdWdpbnMvbWFuaWZlc3QucHk=) | `87.50% <ø> (+2.88%)` | :arrow_up: | | [tests/test\_builtin\_adapters.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=tests%2Ftest_builtin_adapters.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvdGVzdF9idWlsdGluX2FkYXB0ZXJzLnB5) | `96.29% <ø> (+0.46%)` | :arrow_up: | | [tests/test\_console.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=tests%2Ftest_console.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvdGVzdF9jb25zb2xlLnB5) | `95.31% <ø> (-0.02%)` | :arrow_down: | | [tests/test\_examples.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=tests%2Ftest_examples.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvdGVzdF9leGFtcGxlcy5weQ==) | `90.00% <ø> (-0.48%)` | :arrow_down: | | [tests/test\_otiod.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree&filepath=tests%2Ftest_otiod.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvdGVzdF9vdGlvZC5weQ==) | `96.87% <ø> (-0.05%)` | :arrow_down: | | ... and [3 more](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | | ... and [55 files with indirect coverage changes](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). Last update [2c5735c...2723cf9](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1746?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation).
darbyjohnston commented 2 weeks ago

Sorry, was trying to follow the GitHub rebasing steps and seemed to have created a mess again... I may just create a new PR instead of trying to fix this one: #1765