All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: michael.roth@amd.com,  qemu-devel@nongnu.org
Subject: Re: [PATCH v3] qapi: Add documentation format validation
Date: Fri, 31 Oct 2025 11:00:35 +0100	[thread overview]
Message-ID: <87y0or9yrg.fsf@pond.sub.org> (raw)
In-Reply-To: <87ms58fpyn.fsf@pond.sub.org> (Markus Armbruster's message of "Thu, 30 Oct 2025 15:01:52 +0100")

Markus Armbruster <armbru@redhat.com> writes:

> Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
>
>> Add explicit validation for QAPI documentation formatting rules:
>>
>> 1. Lines must not exceed 70 columns in width (including '# ' prefix)
>> 2. Sentences must be separated by two spaces
>>
>> Example sections are excluded, we don't require them to be <= 70,
>> that would be too restrictive.
>>
>> Example sections share common 80-columns recommendations (not
>> requirements).
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
>> ---
>>
>> Hi all!
>>
>> This substitutes my previous attempt
>>   "[PATCH v2 00/33] qapi: docs: width=70 and two spaces between sentences"
>> Supersedes: <20251011140441.297246-1-vsementsov@yandex-team.ru>
>>
>> v3:
>> 01: ignore example sections
>> other commits: dropped :)
>>
>> Of course, this _does not_ build on top of current master. v3 is
>> to be based on top of coming soon doc-cleanup series by Markus.

[...]

>> +        single_space_pattern = r'[.!?] [A-Z0-9]'
>
> This pattern matches possible sentence ends that lack a second space:
> sentence-ending punctuation, single space, capital letter or digit.
>
> The pattern avoids common false positives in the middle of a sentence,
> such as "i.e." here:
>
>     # Describes a block export, i.e. how single node should be exported on
>                                 ~~~~~
>
> Good.  There's still a risk of false positives, though: a capital letter
> need not be the start of a sentence, it could also be a proper noun, or
> the pronoun "I".  I figure the latter is vanishingly unlikely to occur
> in technical documentation.  Example of the former:
>
>     # @format: Extent type (e.g. FLAT or SPARSE)
>
> You filter these out below.
>
> Digits are even more ambiguous than capital letters: they can occur in
> the middle of a sentence as much as at the beginning.  Do they occur?
>
>     $ git-grep '\. [0-9]' \*.json
>     docs/interop/firmware.json:#                of SMRAM. 48MB should suffice for 4TB of guest-phys
>
> Yes, but only in a QAPI schema we don't actually parse.  We should
> probably update these to conform to conventions.  Not today.

Actually, we do parse it, but only in "make check".  See
docs/meson.build.  The cleanup series I just sent covers it.

Unfortunately, this adds another case for you.  In master:

    # @executable: Identifies the firmware executable. The @mode
    #              indicates whether there will be an associated
    #              NVRAM template present. The preferred
    #              corresponding QEMU command line options are
    #                  -drive if=none,id=pflash0,readonly=on,file=@executable.@filename,format=@executable.@format
    #                  -machine pflash0=pflash0
    #              or equivalent -blockdev instead of -drive. When
    #              @mode is @combined the executable must be
    #              cloned before use and configured with readonly=off.
    #              With QEMU versions older than 4.0, you have to use
    #                  -drive if=pflash,unit=0,readonly=on,file=@executable.@filename,format=@executable.@format

My series cleans this up to

    # @executable: Identifies the firmware executable.  The @mode
    #     indicates whether there will be an associated NVRAM template
    #     present.  The preferred corresponding QEMU command line options
    #     are
    #
    #     ::
    #
    #         -drive if=none,id=pflash0,readonly=on,file=@executable.@filename,format=@executable.@format
    #         -machine pflash0=pflash0
    #
    #     or equivalent -blockdev instead of -drive.  When @mode is
    #     @combined the executable must be cloned before use and
    #     configured with readonly=off.  With QEMU versions older than
    #     4.0, you have to use
    #
    #     ::
    #
    #         -drive if=pflash,unit=0,readonly=on,file=@executable.@filename,format=@executable.@format

This uses ReST markup for literal blocks.  There are two forms.

1. A paragraph containing just "::" starts a literal block.

2. A paragraph ending with "::" also starts one.

In either case, the block's contents is indented.

See https://docutils.sourceforge.io/docs/user/rst/quickref.html#literal-blocks
for more.

I think you need to switch literal mode on when you detect a qmp-example
directive or a literal block, and record the line's indentation.  switch
it off at the first line that is no more indented than the recorded
indentation.

[...]



      parent reply	other threads:[~2025-10-31 10:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 17:30 [PATCH v3] qapi: Add documentation format validation Vladimir Sementsov-Ogievskiy
2025-10-30 14:01 ` Markus Armbruster
2025-10-30 18:11   ` Markus Armbruster
2025-10-31  9:42   ` Vladimir Sementsov-Ogievskiy
2025-10-31 10:00   ` Markus Armbruster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y0or9yrg.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.