lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9112679-b251-4b98-b55e-e8aabf82ad46@proton.me>
Date: Fri, 13 Sep 2024 19:34:27 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Joe Perches <joe@...ches.com>, Alice Ryhl <aliceryhl@...gle.com>, Patrick Miller <paddymills@...ton.me>
Cc: a.hindborg@...sung.com, alex.gaynor@...il.com, apw@...onical.com, bjorn3_gh@...tonmail.com, boqun.feng@...il.com, dwaipayanray1@...il.com, gary@...yguo.net, linux-kernel@...r.kernel.org, lukas.bulwahn@...il.com, ojeda@...nel.org, rust-for-linux@...r.kernel.org, tmgross@...ch.edu, wedsonaf@...il.com
Subject: Re: [PATCH v3 2/2] checkpatch: warn on known non-plural rust doc headers

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@...ton.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ