qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* qapi: [RFC] Doc comment convention for @arg: sections
@ 2023-03-23 14:48 Markus Armbruster
  2023-03-23 16:20 ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2023-03-23 14:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eric Blake, Michael Roth,
	Konstantin Kostiuk, Victor Toso, Daniel P. Berrangé,
	Peter Maydell, Paolo Bonzini

The QAPI schema doc comment language provides special syntax for command
and event arguments, struct and union members, alternate branches,
enumeration values, and features: "sections" starting with @arg:.

By convention, we format them like this:

    # @arg: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
    #       do eiusmod tempor incididunt ut labore et dolore magna
    #       aliqua.

Okay for names as short as "name", but we have much longer ones.  Their
description gets squeezed against the right margin, like this:

    # @dirty-sync-missed-zero-copy: Number of times dirty RAM synchronization could
    #                               not avoid copying dirty pages. This is between
    #                               0 and @dirty-sync-count * @multifd-channels.
    #                               (since 7.1)

The description is effectively 50 characters wide.  Easy enough to read,
but awkward to write.

The awkward squeeze against the right margin makes people go beyond it,
which produces two undesirables: arguments about style, and descriptions
that are unnecessarily hard to read, like this one:

    # @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.  This is
    #                           only present when the postcopy-blocktime migration capability
    #                           is enabled. (Since 3.0)

Ugly, too.

I'd like to change the convention to

    # @arg:
    #     Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
    #     do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    # @dirty-sync-missed-zero-copy:
    #     Number of times dirty RAM synchronization could not avoid
    #     copying dirty pages.  This is between 0 and @dirty-sync-count
    #     * @multifd-channels.  (since 7.1)

    # @postcopy-vcpu-blocktime:
    #     list of the postcopy blocktime per vCPU.  This is only present
    #     when the postcopy-blocktime migration capability is
    #     enabled.  (Since 3.0)

We may want to keep short descriptions one the same line, like

    # @multifd-bytes: The number of bytes sent through multifd (since 3.0)

We could instead do

    # @arg: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
    #     do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Another option would be

    # @arg:
    # Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
    # eiusmod tempor incididunt ut labore et dolore magna aliqua.

or even

    # @arg: Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    # sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

but I find these less readable.

A bulk reformatting of doc comments will mess up git-blame, which will
be kind of painful[*].  But so is the status quo.

Thoughts?



[*] Yes, I'm aware of (and grateful for) --ignore-rev & friends.  It's
still kind of painful.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-24 15:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23 14:48 qapi: [RFC] Doc comment convention for @arg: sections Markus Armbruster
2023-03-23 16:20 ` Peter Maydell
2023-03-24 12:05   ` Markus Armbruster
2023-03-24 12:42     ` Peter Maydell
2023-03-24 14:25       ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).