All of lore.kernel.org
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] checkpatch: add fix option for NETWORKING_BLOCK_COMMENT_STYLE
@ 2020-11-18 17:09 Aditya Srivastava
  2020-11-18 17:13 ` Aditya
  0 siblings, 1 reply; 20+ messages in thread
From: Aditya Srivastava @ 2020-11-18 17:09 UTC (permalink / raw)
  To: lukas.bulwahn; +Cc: linux-kernel-mentees, yashsri421

Currently, checkpatch warns us if we use an empty '/*' line for comment
and contents of the comment are in next line.

E.g., running checkpatch on commit 0d52497ac8ee ("iwlwifi: pcie: remove
the refs / unrefs from the transport") reports this warning:

WARNING: networking block comments don't use an empty /* line, use /* Comment...
+		/*
+		 * If the TXQ is active, then set the timer, if not,

Provide a fix by appending the current line contents to previous line
and deleting the current line

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f61ac7456151..90e863d63097 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3629,8 +3629,14 @@ sub process {
 		    $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
 		    $rawline =~ /^\+[ \t]*\*/ &&
 		    $realline > 3) { # Do not warn about the initial copyright comment block after SPDX-License-Identifier
-			WARN("NETWORKING_BLOCK_COMMENT_STYLE",
-			     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
+			if (WARN("NETWORKING_BLOCK_COMMENT_STYLE",
+				 "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev) &&\
+			    $fix) {
+				if ($rawline =~ /^\+[ \t]*\*\s*(.*)/) {
+					fix_delete_line($fixlinenr, $rawline);
+					$fixed[$fixlinenr - 1] .= " $1";
+				}
+			}
 		}
 
 # Block comments use * on subsequent lines
-- 
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-12-21 15:58 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 17:09 [Linux-kernel-mentees] [PATCH] checkpatch: add fix option for NETWORKING_BLOCK_COMMENT_STYLE Aditya Srivastava
2020-11-18 17:13 ` Aditya
2020-11-18 17:39   ` [Linux-kernel-mentees] [PATCH v2] " Aditya Srivastava
2020-11-18 19:00     ` Lukas Bulwahn
2020-11-19 10:44       ` Aditya
2020-11-21 12:09         ` Aditya
2020-11-22  6:52         ` Lukas Bulwahn
2020-11-25  7:02           ` Aditya
2020-11-25  7:19             ` Lukas Bulwahn
2020-11-25 12:38               ` Lukas Bulwahn
2020-11-29 14:58                 ` Aditya
2020-11-30 10:10                   ` Lukas Bulwahn
2020-11-30 16:47                     ` Aditya
2020-11-30 16:57                       ` Lukas Bulwahn
2020-11-30 17:50                         ` Aditya
2020-12-20 18:33                         ` [Linux-kernel-mentees] [PATCH] checkpatch: ignore files not following NETWORKING_BLOCK_COMMENT_STYLE Aditya Srivastava
2020-12-20 18:54                           ` Aditya
2020-12-21  5:27                           ` Lukas Bulwahn
2020-12-21 15:29                             ` Aditya
2020-12-21 15:58                               ` Lukas Bulwahn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.