-
Notifications
You must be signed in to change notification settings - Fork 543
CXX-3064 Fix use of Doxygen @relates, @relatesalso, and groups #1170
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kevinAlbs
reviewed
Jul 18, 2024
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.
The documentation improvements are greatly appreciated.
kevinAlbs
approved these changes
Jul 19, 2024
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 with one additional comment.
This was referenced Jul 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Resolves CXX-3064. Related to CXX-2827.
This PR is a parallel companion to #1169. Whereas #1169 focuses on the deployment process and tooling, this PR focuses on various fixes and improvements to the contents of the current API docs itself.
The "Incompleteness" Problem
The Doxyfile sets
EXTRACT_ALL = NO
. This enables warnings for undocumented entities. However, this also means directories and namespaces MUST be explicitly documented in order to properly generate their corresponding pages. This is the reason behind so many pages for directories and namespaces being completely devoid of useful information or missing a navigatable page entirely.For example, this is the page for the
bsoncxx/v_noabi/bsoncxx
directory (note: subdirectory information is completely absent despite having pages):Undocumented headers do not generate a page at all (hence their absence in directory pages as above):
Undocumented namespaces similarly do not generate a page at all:
This means the "array" in "bsoncxx > v_noabi > array > element" is not navigatable/interactable (among many similar cases of "dead" links):
These factors all contribute to a feeling of "incompleteness" in the quality of the API docs.
This PR lays the foundations to address all of the issues described above. However, the addition of documentation of directories, namespaces, and files are deferred to a followup PR due to the volume of changes required.
A preview of upcoming changes:
Root Level Forward Headers
This PR adds a
bsoncxx/fwd.hpp
andmongocxx/fwd.hpp
at the library root level, not to be confused withbsoncxx/v_noabi/bsoncxx/fwd.hpp
andmongocxx/v_noabi/mongocxx/fwd.hpp
added by #1061. These headers are NOT expected to be included or even includeable (<bsoncxx/v_noabi/bsoncxx>
is prioritized before<bsoncxx>
by include directory search paths, so these newfwd.hpp
headers will never be found). Nevertheless, just in case, they are defined to behave equivalently to theirv_noabi
counterparts should they be included anyways.These headers may be renamed to something else if
fwd.hpp
is confusing for their purpose.The purpose of these headers is to provide a definitive location to add Doxygen documentation for root-level directories and namespaces.
#1039 (comment) added some of these docs to the
prelude.hpp
headers, as forward headers were not yet implemented at the time. These are relocated to their corresponding forward headers.The addition of documentation of directories, namespaces, and files are deferred to a followup PR due to the volume of changes required.
Sorted Documentation
This PR proposes setting various
SORT_*
options toYES
. This is primarily to automate the (alphabetical) grouping of related functions without requiring use of Doxygen groups. This will secondarily discourage writing documentation sensitive to in-source-declaration-order (e.g. "see above/below") allowing for greater freedom of in-source ordering without impacting API documentation results.@relates
,@relatesalso
, and GroupsAfter much pain and debugging, some rules were derived:
@relatesalso
is not equivalent to@see
.@relatesalso
is not inherited by group members (@relates
is).@{
, not after, except whenDISTRIBUTE_GROUP_DOC
applies instead (reuse doc of first group member for the rest).This PR addresses all known violations of these rules by applying the following patterns (and generally avoiding use of groups when able):
It is important to use
@relatesalso
for non-member functions (especially operators) to ensure their declaration is included in the documentation of the enclosing namespace. Otherwise, they are only documented in the related class page. This is especially important for correctly documenting root namespace redeclarations in CXX-2745.Use of per-member documentation should be avoided whenever possible to avoid the complexities of merging group-and-member documentations (
@param
commands in particular are a problem). Copying relevant documentation per member (e.g.mongocxx::v_noabi::hint::operator==
overloads) is preferable to twisting contents to accomodate all group members.BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR
This (and its mongocxx counterpart) are added to facilitate workarounds for the very unfortunate Doxygen using-declaration problem described in #1066. These workarounds will come in a followup PR, but as a preview of their intended usage:
A preview of the results:
This will be discussed in greater detail in the relevant followup PR.
STRIP_FROM_PATH = ON
Old:
New:
Miscellaneous
BSONCXX_INLINE=inline
(+ mongocxx) to correctly communicate inline functions to Doxygen.CommentPragmas
to avoid breaking long Doxygen commands by wrapping (e.g.@copydoc
).@internal
inutil.hpp
.