All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Srivastava <yashsri421@gmail.com>
To: lukas.bulwahn@gmail.com
Cc: linux-kernel-mentees@lists.linuxfoundation.org, yashsri421@gmail.com
Subject: [Linux-kernel-mentees] [PATCH] checkpatch: ignore files not following NETWORKING_BLOCK_COMMENT_STYLE
Date: Mon, 21 Dec 2020 00:03:07 +0530	[thread overview]
Message-ID: <20201220183307.8744-1-yashsri421@gmail.com> (raw)
In-Reply-To: <CAKXUXMz6TuYZkZJbgDBPiH4MmecUUbLjPct9XnZZu12VP+w4mw@mail.gmail.com>

Currently checkpatch.pl gives warning for NETWORKING_BLOCK_COMMENT_STYLE
for files in net/ and drivers/net which do not follow the networking
comment style.
But some of these files seem to follow the generic comment style instead
of networking style and some rather mixed style of comment.

For e.g., drivers/net/wireless/ralink/rt2x00 largely follows generic
kernel comment style in spite of being inside drivers/net.

Provide an ignore file(".networking_block_comment_styles.ignore"), where
users can add the files they want to ignore this warning.

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
---
 .gitignore                              |  1 +
 .networking_block_comment_styles.ignore |  1 +
 scripts/checkpatch.pl                   | 25 ++++++++++++++++++++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 .networking_block_comment_styles.ignore

diff --git a/.gitignore b/.gitignore
index d01cda8e1177..3cd6074d1fb0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -94,6 +94,7 @@ modules.order
 !.gitattributes
 !.gitignore
 !.mailmap
+!.networking_block_comment_styles.ignore
 
 #
 # Generated include files
diff --git a/.networking_block_comment_styles.ignore b/.networking_block_comment_styles.ignore
new file mode 100644
index 000000000000..2022dd619901
--- /dev/null
+++ b/.networking_block_comment_styles.ignore
@@ -0,0 +1 @@
+drivers/net/wireless/ralink/rt2x00
\ No newline at end of file
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 00085308ed9d..875e572df5dc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -832,6 +832,28 @@ sub read_words {
 	return 0;
 }
 
+my @files_ignoring_networking_comment;
+my $ignore_file = which_conf(".networking_block_comment_styles.ignore");
+if(-f $ignore_file) {
+	open(my $ignore, '<', "$ignore_file")
+	    or warn "$P: Can't find a readable .networking_block_comment_styles.ignore file $!\n";
+	while(<$ignore>) {
+		my $line = "$_";
+		$line = trim($line);
+		next if ($line =~ /^\s*$/);
+		push(@files_ignoring_networking_comment, $line);
+	}
+	close($ignore);
+}
+
+sub ignore_networking_comment_style {
+	my ($realfile) = "@_";
+	foreach my $file (@files_ignoring_networking_comment) {
+		return 1 if ($realfile =~ m@^$file@);
+	}
+	return 0;
+}
+
 my $const_structs;
 if (show_type("CONST_STRUCT")) {
 	read_words(\$const_structs, $conststructsfile)
@@ -3701,7 +3723,8 @@ sub process {
 		if ($realfile =~ m@^(drivers/net/|net/)@ &&
 		    $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
 		    $rawline =~ /^\+[ \t]*\*/ &&
-		    $realline > 3) { # Do not warn about the initial copyright comment block after SPDX-License-Identifier
+		    $realline > 3 &&  # Do not warn about the initial copyright comment block after SPDX-License-Identifier
+		    !ignore_networking_comment_style($realfile)) {
 			WARN("NETWORKING_BLOCK_COMMENT_STYLE",
 			     "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
 		}
-- 
2.17.1

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

  parent reply	other threads:[~2020-12-20 18:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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                         ` Aditya Srivastava [this message]
2020-12-20 18:54                           ` [Linux-kernel-mentees] [PATCH] checkpatch: ignore files not following NETWORKING_BLOCK_COMMENT_STYLE Aditya
2020-12-21  5:27                           ` Lukas Bulwahn
2020-12-21 15:29                             ` Aditya
2020-12-21 15:58                               ` Lukas Bulwahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201220183307.8744-1-yashsri421@gmail.com \
    --to=yashsri421@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=lukas.bulwahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.