rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: Joe Perches <joe@perches.com>, Alice Ryhl <aliceryhl@google.com>,
	Patrick Miller <paddymills@proton.me>
Cc: a.hindborg@samsung.com, alex.gaynor@gmail.com, apw@canonical.com,
	bjorn3_gh@protonmail.com, boqun.feng@gmail.com,
	dwaipayanray1@gmail.com, gary@garyguo.net,
	linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com,
	ojeda@kernel.org, rust-for-linux@vger.kernel.org,
	tmgross@umich.edu, wedsonaf@gmail.com
Subject: Re: [PATCH v3 2/2] checkpatch: warn on known non-plural rust doc headers
Date: Fri, 13 Sep 2024 19:34:27 +0000	[thread overview]
Message-ID: <a9112679-b251-4b98-b55e-e8aabf82ad46@proton.me> (raw)
In-Reply-To: <ab5a84a40a5bf73001cd35f6f9108830ff70c5ee.camel@perches.com>

On 13.09.24 21:21, Joe Perches wrote:
> On Fri, 2024-09-13 at 09:33 +0200, Alice Ryhl wrote:
>> On Thu, Sep 12, 2024 at 9:57 PM Patrick Miller <paddymills@proton.me> wrote:
>>> @@ -3900,6 +3900,13 @@ sub process {
>>>                              "Avoid using '.L' prefixed local symbol names for denoting a range of code via 'SYM_*_START/END' annotations; see Documentation/core-api/asm-annotations.rst\n" . $herecurr);
>>>                 }
>>>
>>> +# check that document section headers are plural in rust files
>>> +               if ($realfile =~ /\.rs$/ &&
>>> +                   $rawline =~ /^\+\s*\/\/\/\s+#+\s+(Example|Invariant|Guarantee|Panic)\s*$/) {

@Patrick, could you also add `Error` to this list?

>>> +                       WARN("RUST_DOC_HEADER",
>>> +                            "Rust doc headers should be plural\n" . $herecurr);
> 
> While OK my suggestion would be to add a $fix option
> and be case insensitive
> 
> 		if ($realfile =~ /\.rs$/ &&
> 		    $rawline =~ /^\+\s*\/\/\/\s+#+\s+(Example|Invariant|Guarantee|Panic)\s*$/i) {
> 			if (WARN("RUST_DOC_HEADER",
> 	                       	 "Rust doc header '$1' should be plural\n" . $herecurr) &&
> 			    $fix) {
> 				$fixed[$fixlinenr] = s/\b$1\b/ucfirst(lc($1))/e;
> 			}
> 
> And if there are going to be more rust specific tests,
> there should be a rust specific block to avoid continual
> tests of $realfile =~ /\.rs$/

Yes please, we're already planning more checks.

---
Cheers,
Benno


  reply	other threads:[~2024-09-13 19:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 19:56 [PATCH v3 2/2] checkpatch: warn on known non-plural rust doc headers Patrick Miller
2024-09-13  7:33 ` Alice Ryhl
2024-09-13 19:21   ` Joe Perches
2024-09-13 19:34     ` Benno Lossin [this message]
2024-09-13 11:30 ` Benno Lossin
2024-09-14 18:16 ` [PATCH v4 " Patrick Miller

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=a9112679-b251-4b98-b55e-e8aabf82ad46@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apw@canonical.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=gary@garyguo.net \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=paddymills@proton.me \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=wedsonaf@gmail.com \
    /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 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).