[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <22250c3f011a324ed4ab99ea0925090b824ffb8a.1726479606.git.hridesh699@gmail.com>
Date: Mon, 16 Sep 2024 15:23:40 +0530
From: Hridesh MG <hridesh699@...il.com>
To: linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Cc: Hridesh MG <hridesh699@...il.com>,
Andy Whitcroft <apw@...onical.com>,
Joe Perches <joe@...ches.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: [PATCH v3 2/2] checkpatch: warn on empty rust doc comments
Add a check to warn if there are consecutive empty `///` lines in rust
files.
Suggested-by: Miguel Ojeda <ojeda@...nel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1109
Signed-off-by: Hridesh MG <hridesh699@...il.com>
---
No changes in v2, this is a new patch
No changes in v3
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 39032224d504..c75bc3927bf6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3884,6 +3884,13 @@ sub process {
}
}
+# check for consecutive empty /// lines in .rs files
+ if ($realfile =~ /\.rs$/ &&
+ $rawline =~ /^\+\s*\/\/\/$/ && $prevrawline =~ /^\+\s*\/\/\/$/) {
+ WARN("RUST_DOC_EMPTY",
+ "avoid using consecutive empty rustdoc comments\n" . $herecurr);
+ }
+
# check for adding lines without a newline.
if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
if (WARN("MISSING_EOF_NEWLINE",
--
2.46.0
Powered by blists - more mailing lists