-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix(docbuild): Update style doc to reflect Doxygen needs #6705
fix(docbuild): Update style doc to reflect Doxygen needs #6705
Conversation
Hi, Gabor! ( @kisvegabor ) I submitted this one separately so you could have a look at it in an easier way than in the #6480 issue. Once we get the details of this sorted (or if you like it as it is), I suggest we start a new project, perhaps under issue #6671 "Add missing documentation", and make these modifications to some of the core part of the library to set an example. This contains 2 changes:
In the "Doxygen Comment Specifics" section, I left the Over to you. I hope you like it. FYI I am kind of on a Europe schedule right now to give us more common time on our schedules (why you have seen me posting things very early). Kind regards, |
docs/CODING_STYLE.rst
Outdated
* - create keyboard (lv_x11_keyboard_create) | ||
* - create mouse (with scroll wheel, lv_x11_mouse_create lv_x11_mousewheel_create) | ||
* | ||
* @param[in] disp object created by lv_x11_window_create() |
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.
[in] and [out] are not widely used, so we shouldn't make then mandatory.
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.
Agreed.
docs/CODING_STYLE.rst
Outdated
lv_obj_t * lv_obj_get_screen(lv_obj_t * obj); | ||
void lv_x11_inputs_create(lv_display_t * disp, lv_image_dsc_t const * mouse_img); | ||
|
||
Separate sections within the comment with a blank line for added readability. |
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.
Not used now either.
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.
@kisvegabor Hi, Gabor! Ouch. Okay, I removed that line (to be re-pushed shortly). Kevin and I discussed this in issue #6480, and I think I erroneously interpreted no response from you on that point as agreement. While I am coding, I rely on documentation in the code more than in an external documentation, so I find it extremely helpful when the documentation in the code is easier to read. Are you thinking of approach this gradually? Or prefer no blank lines? What are your thoughts are about it for now and in the future?
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'd prefer no blank lines to keep the docs section more condensed.
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'd prefer no blank lines to keep the docs section more condensed.
Understood. Thank you for the clarification.
docs/CODING_STYLE.rst
Outdated
Include a space after the ``/*`` and before the ``*/`` for added readability. | ||
|
||
If you are writing documentation for a code member (like a function, data type | ||
or macro), use Doxygen comments like this: ``/** Description */``. See |
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.
Or /**< ... */
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.
Good point! Done.
Thank you Vic. I've added my initial comments . |
Hi, Gabor! I've realized that introducing |
@kisvegabor Okay. Re-submitted. I found I needed to run it through In case you were not already aware, the leading "|" in lines tell ReStructuredText where to line wrap, when it is important. Thus:
comes out the same way as this in HTML:
I used that in a couple of cases to make it more readable. I also:
|
ccce3d9
to
edc65a8
Compare
@kisvegabor Hi, Gabor! Ready for re-review/approval/merging. |
Thank you! I can review it next week. |
Okay. |
bc12da5
to
6e8035b
Compare
Hi, Gabor! ( @kisvegabor ) This is just a reminder that the view of the CODING_STYLE.rst file after |
6e8035b
to
379215e
Compare
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 Vic! The content is very useful, however I feel like it's a little bit lengthy and developers might not read it.
I think we should have
- a simple Doxygen API comment example with 1 param and return, and explain the basics there
- a complex example and explain all the keywords we (not Doxygen) support
If possible the explanations should be one liner bullet points to allow quickly processing them.
For example this
To refer the reader to additional information, you can say something like
``See also `data_type_t`.`` or ``See function_name() for more information.``.
Doxygen will convert ``data_type_t`` or ``function_name()`` into a hyperlink to that
documentation when it exists.
can be converted to
- Reference types and functions like `lv_display_t` and `lv_display_create()`. They will be converted to hyperlinks.
docs/CODING_STYLE.rst
Outdated
.. code:: c | ||
/** | ||
* Brief description | ||
* |
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.
No blank lines 🙂
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.
No blank lines 🙂
Hi, Gabor. Can you clarify what is meant here? Do you mean you want something like this:
/**
* Set how to place (where to align) the items and tracks
*
* @param obj pointer to object. Its parent must have flex layout
* or nothing will happen.
* @param main_place where to place items on main axis (in their track).
* Any value of `lv_flex_align_t`.
* @param cross_place where to place item in track on cross axis.
* `LV_FLEX_ALIGN_START/END/CENTER`
* @param track_cross_place where to place tracks in cross direction.
* Any value of `lv_flex_align_t`.
*
* @note The resulting behavior is very similar to flex containers in CSS.
*/
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
lv_flex_align_t track_cross_place);
to be this instead?
/**
* Set how to place (where to align) the items and tracks
* @param obj pointer to object. Its parent must have flex layout
* or nothing will happen.
* @param main_place where to place items on main axis (in their track).
* Any value of `lv_flex_align_t`.
* @param cross_place where to place item in track on cross axis.
* `LV_FLEX_ALIGN_START/END/CENTER`
* @param track_cross_place where to place tracks in cross direction.
* Any value of `lv_flex_align_t`.
* @note The resulting behavior is very similar to flex containers in CSS.
*/
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
lv_flex_align_t track_cross_place);
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.
Yes, I meant that. Just because we don't have empty lines after the brief now, so it would be strange to ask for the opposite.
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.
Yes, I meant that. Just because we don't have empty lines after the brief now, so it would be strange to ask for the opposite.
That completely makes sense to me. thumbs up
docs/CODING_STYLE.rst
Outdated
/** | ||
* Brief description | ||
* | ||
* @return short description of return value |
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.
Add param
too to have simple yet complete example
* @return short description of return value | |
* @param value short description of the parameter | |
* @return short description of return value |
docs/CODING_STYLE.rst
Outdated
* @param mouse_img optional image description for mouse cursor | ||
* (NULL for no/invisible mouse cursor) | ||
* | ||
* @note Include any subtle points an API user or maintainer would need to know. |
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.
Shall we show code
and example
too?
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.
Shall we show
code
andexample
too?
I'm not sure I am understanding the concept. Can you clarify? Are you referring to making the example more complete so it shows we encourage placing code elements in single back-quotes?
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 just meant that we support more Doxygen tags (@....
) and we can show them in a single complete example.
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 just meant that we support more Doxygen tags (
@....
) and we can show them in a single complete example.
Ah!! Agreed. I think you will like what I have come up with.
docs/CODING_STYLE.rst
Outdated
|
||
``variable_or_struct_member; /**< Description of code member BEFORE this comment. */`` | ||
|
||
Add 2 spaces after Doxygen commands (they start with '@') for improved readability. |
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.
Now we add only 1 space, e.g. @param value
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.
Now we add only 1 space, e.g.
@param value
I know, and in the code, it is really difficult to read in some cases!
Imagine you know nothing about this function and then compare this (example 1):
/**
* Set how to place (where to align) the items and tracks
* @param obj pointer to an object. The parent must have flex layout else nothing will happen.
* @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`.
* @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER`
* @param track_cross_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`.
*/
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
lv_flex_align_t track_cross_place);
with this (example 2):
/**
* Set how to place (where to align) the items and tracks
* @param obj pointer to an object. The parent must have flex layout else nothing will happen.
* @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`.
* @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER`
* @param track_cross_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`.
*/
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
lv_flex_align_t track_cross_place);
This is better for people that don't have really wide screens (example 3).
/**
* Set how to place (where to align) the items and tracks
* @param obj pointer to object. Its parent must have flex layout
* or nothing will happen.
* @param main_place where to place items on main axis (in their track).
* Any value of `lv_flex_align_t`.
* @param cross_place where to place item in track on cross axis.
* `LV_FLEX_ALIGN_START/END/CENTER`
* @param track_cross_place where to place tracks in cross direction.
* Any value of `lv_flex_align_t`.
* @note The resulting behavior is very similar to flex containers in CSS.
*/
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
lv_flex_align_t track_cross_place);
And I think this is even easier to read, though the "gain" in readability is only slight (example 4).
/**
* Set how to place (where to align) the items and tracks
*
* @param obj pointer to object. Its parent must have flex layout
* or nothing will happen.
* @param main_place where to place items on main axis (in their track).
* Any value of `lv_flex_align_t`.
* @param cross_place where to place item in track on cross axis.
* `LV_FLEX_ALIGN_START/END/CENTER`
* @param track_cross_place where to place tracks in cross direction.
* Any value of `lv_flex_align_t`.
*
* @note The resulting behavior is very similar to flex containers in CSS.
*/
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
lv_flex_align_t track_cross_place);
I think we should promote example example 3 or 4 (rather than promoting what is in the code -- which is part of why it is difficult, sometimes painful [no I am not exaggerating] to learn LVGL).
Of course, if you're thinking about making the documentation align with the code for v9.2, I can understand that, but I am thinking about a future scenario where the ease of reading the documentation will be an important asset in LVGL's popularity.
Thoughts?
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.
Wow, it really looks better. I vote for example 3
. Example 4
might be ok too, but I'm not sure so let's stay on the safe side and go for example 3
. Once it's merged, in a new PR we can add the missing spaces with a script.
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.
Wow, it really looks better. I vote for
example 3
.Example 4
might be ok too, but I'm not sure so let's stay on the safe side and go forexample 3
. Once it's merged, in a new PR we can add the missing spaces with a script.
Agreed! It seems we think very similarly--harmony first (i.e. not huge disagreement between CODING_STYLE.rst and what's actually in the library), then advance the library by increments.
docs/CODING_STYLE.rst
Outdated
Align the beginning of each argument description for improved readability. Provide | ||
at least 2 spaces after the longest argument name for visual separation (improves | ||
readability). If a description of an argument continues on subsequent lines, indent | ||
the continuation lines by an additional 4 spaces to visually distinguish these lines |
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 is more readable to me. Does it work too?
* @param filter event code (e.g. `LV_EVENT_CLICKED`) indicating which
* event should be called (`LV_EVENT_ALL` can be used
* to receive all events)
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.
Does it work too?
Certainly there is no loss to the ease of reading it. In your example, I am counting 5 spaces after the longest argument. Would you like me to specify 5 spaces as a minimum? Or simply use 5 spaces in the examples?
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 think we shouldn't control the number of spaces just ask for uniformly indenting the description. IMO It's enough to show it in the example.
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 think we shouldn't control the number of spaces just ask for uniformly indenting the description. IMO It's enough to show it in the example.
That makes the most sense to me as well!
the continuation lines by an additional 4 spaces to visually distinguish these lines | ||
from the beginning of a new argument description, like this: | ||
|
||
.. code-block:: c |
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 and the blow sections feels redundant with Line 87.
Can we a have a single complex example and explain it one liner bullet points?
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.
feels redundant with Line 87.
Can we a have a single complex example and explain it one liner bullet points?
Good point, and excellent idea! I will work on that.
Great points, and I really like your attention to brevity! I know in this world, compactness (brevity, succinctness) is very helpful. Historically, a 2nd pair of eyes helps me to not get carried away, where half the number of words (or less, or an illustration) can carry the same meaning faster. I will work on this. |
Hi, Gábor! ( @kisvegabor ) Okay, I have re-submitted. Here is what the document now looks like after it has been run through Things that we did not discuss above:
I placed additional "Do not ..." information with the Kevin ( @kdschlosser ), you may be pleased to know that I removed the "rare" ones from the list we previously discussed, so it is now down to:
And I didn't mention the :-) Kind regards, |
the This is how a heading gets anchored in Sphinx .. _some_heading_anchor:
Some Heading
--------------- so having anchors in the API documentation is not going to get linked to properly when referencing an anchor. The other thing that should be done is to see if the anchors are even being used.... If they are then maybe changing the reference to that anchor to something that is able to be referenced in Sphinx like the object that has the documentation that is wanting to be referenced. |
also with the @code directive, we need to change those so they have an explicit code type set...
Here is a complete list of extensions you can use... |
what would actually be better than supplying the file extension is supplying the short name... it can be one of the following names... 842 names across 548 languages
|
Thanks! I still see a little redundancy here and there, but it should be okay now.
|
cc: @kisvegabor In reality, there is probably no good reason to keep I will adjust the document accordingly. About |
8dfe6a8
to
e3ff2d4
Compare
Okay! Re-submitted. I believe that takes care of everything we have discussed up to this point, but the question about the And this document is updated to show the "after-sphinx" appearance. |
When I finish up with the script that hopefully will replace Breathe we will be given the ability to use ReST syntax directly in the doxygen docstrings. If there is some need to reference other areas of the documentation it will be as easy as ":ref:`some_reference_name`" and if wanting to reference something in doxygen docstrings it will be one of the following...
|
I created a development discussion issue for a Breathe replacement. This is mostly for me to be able to remember how things are supposed to work and what I need to do to make things work. |
Very nice!! Got it regarding the Breathe replacement issue #6770. |
Hi, Gábor! ( @kisvegabor ) An indicated off-shoot of modifying Kind regards, |
d185e4d
to
ca2974e
Compare
...also fix things that did not look right after it was run through `sphinx`. Final document in same style as generated documents uploaded here to see what it will look like in generated documentation http://crystal-clear-research.com/for_gabor/demo/CODING_STYLE.html Addresses part of issue lvgl#6480.
...since they apply to prototypes in all .h files, not a limited subset. Applies to issue lvgl#6480.
Addresses part of issue lvgl#6480.
This change majorly reduces the amount of text describing what we want to see in documenting comments, preferring illustrative example to lengthy descriptions, and allowing flexibility where possible. Addresses part of issue lvgl#6480.
Addresses part of issue lvgl#6480.
Addresses part of issue lvgl#6480.
…ion. Addresses part of issue lvgl#6480.
Addresses part of issue lvgl#6480.
Addresses part of issue lvgl#6480.
Addresses part of issue lvgl#6480,
Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
...not both typedef struct _type_t {...} type_t both at the same time. Addresses part of issue lvgl#6480.
de08b3e
to
aef711b
Compare
@liamHowatt @kisvegabor Liam had some great observations. I agreed with all, and have re-submitted, and updated the generated demonstration document with the updates. |
I did find out something with doxygen. It will NOT add a "brief description" unless you specifically use the |
Hi, Kevin!
|
don't know the answer to either of those questions as I have never tested it. I do know that the "briefdescription" element in the XML only seems to get populated when the |
@liamHowatt Good morning! I could use your approval on this again now that I have re-submitted. :-) |
Thank you! |
Thank you, Vic! |
Yeayyy!! **celebrating completion** 👍 As you know, I'm honored to be able to help this way. :-) |
Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
Description of the feature or fix
Update CODING_STYLE.rst to reflect updated Doxygen requirements in comments.
Addresses part of issue #6480
Notes
lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py
(astyle version v3.4.12 needs to be installed) and follow the Code Conventions.