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-next>] [day] [month] [year] [list]
Message-ID: <20240906180456.2302688-1-paddymills@proton.me>
Date: Fri, 06 Sep 2024 18:05:01 +0000
From: Patrick Miller <paddymills@...ton.me>
To: a.hindborg@...sung.com, alex.gaynor@...il.com, aliceryhl@...gle.com, apw@...onical.com, benno.lossin@...ton.me, bjorn3_gh@...tonmail.com, boqun.feng@...il.com, dwaipayanray1@...il.com, gary@...yguo.net, joe@...ches.com, linux-kernel@...r.kernel.org, lukas.bulwahn@...il.com, ojeda@...nel.org, rust-for-linux@...r.kernel.org, tmgross@...ch.edu, wedsonaf@...il.com
Cc: Patrick Miller <paddymills@...ton.me>
Subject: [PATCH 2/2] checkpatch: warn on known non-plural rust doc headers

Adds a check for documentation in rust file. Warns if certain known
documentation headers are not plural. Even though some sections may
be singular (i.e. only one example), the header should still be plural
so that more examples can be added later without needing to change the
header.

Fixed the whitespace issue on my previous patch.

Signed-off-by: Patrick Miller <paddymills@...ton.me>
Suggested-by: Miguel Ojeda <ojeda@...nel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1110

---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 39032224d504..cb5ecdb6df9b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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 sec
tion headers are plural in rust files
+		if ($realfile =~ /\.rs$/
+			&& $rawline =~ /^\+\s*\/\/\/\s+#+\s+(Example|Invariant|Guarantee|Panic)\s*$/) {
+			WARN( "RUST_DOC_HEADER",
+				"Rust doc headers should be plural\n" . $herecurr );
+		}
+
 # check we are in a valid source file C or perl if not then ignore this hunk
 		next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);
 
-- 
2.46.0


Download attachment "publickey - paddymills@...ton.me
 - 0xDCA74891.asc" of type "application/pgp-keys" (705 bytes)

Download attachment "signature.asc" of type "application/pgp-signature" (250 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ