[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32382c55dbcb6482d6e686d541c2e15b282908cd.1728818976.git.hridesh699@gmail.com>
Date: Tue, 15 Oct 2024 21:21:39 +0530
From: Hridesh MG <hridesh699@...il.com>
To: rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Andreas Hindborg <a.hindborg@...nel.org>,
Boqun Feng <boqun.feng@...il.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Andy Whitcroft <apw@...onical.com>,
Joe Perches <joe@...ches.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
Hridesh MG <hridesh699@...il.com>,
Jens Axboe <axboe@...nel.dk>,
Wedson Almeida Filho <walmeida@...rosoft.com>,
Valentin Obst <kernel@...entinobst.de>,
Patrick Miller <paddymills@...ton.me>,
Alex Mantel <alexmantel93@...lbox.org>,
Matt Gilbride <mattgilbride@...gle.com>,
Aswin Unnikrishnan <aswinunni01@...il.com>,
Martin Rodriguez Reboredo <yakoyoku@...il.com>,
FUJITA Tomonori <fujita.tomonori@...il.com>
Subject: [PATCH v6 4/4] 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>
---
v2: https://lore.kernel.org/rust-for-linux/7877d23adba22e2f89a61efc129ecf1b0627510b.1726072795.git.hridesh699@gmail.com/
- new patch
v3: https://lore.kernel.org/rust-for-linux/bf6544faba2b53ce901b2e031f3d944babcc7018.1727606659.git.hridesh699@gmail.com/
- no changes
v6:
- added --fix support which deletes the unnecessary line
---
scripts/checkpatch.pl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c390a9926cd5..baadc345bf87 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3911,6 +3911,15 @@ sub process {
$fixed[$fixlinenr] =~ s/\b$header\b/ucfirst(lc($header)) . 's'/e;
}
}
+
+ # check for consecutive empty rustdoc lines
+ if ($rawline =~ /^\+\s*\/\/\/$/ && $prevrawline =~ /^\+?\s*\/\/\/$/) {
+ if (WARN("RUST_DOC_EMPTY",
+ "avoid using consecutive empty rustdoc comments\n" . $herecurr) &&
+ $fix) {
+ fix_delete_line($fixlinenr, $rawline);
+ }
+ }
}
# check we are in a valid source file C or perl if not then ignore this hunk
--
2.46.1
Powered by blists - more mailing lists