All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: krzk@kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
	joe@perches.com, geert@linux-m68k.org, netdev@vger.kernel.org,
	workflows@vger.kernel.org, mario.limonciello@amd.com
Subject: [PATCH] scripts: checkpatch: steer people away from using file paths
Date: Tue, 25 Jul 2023 08:59:26 -0700	[thread overview]
Message-ID: <20230725155926.2775416-1-kuba@kernel.org> (raw)
In-Reply-To: <b6ab3c25-eab8-5573-f6e5-8415222439cd@kernel.org>

We repeatedly see noobs misuse get_maintainer by running it on
the file paths rather than the patchfile. This leads to authors
of changes (quoted commits and commits under Fixes) not getting
CCed. These are usually the best reviewers!

The file option should really not be used by noobs, unless
they are just trying to find a maintainer to manually contact.

Print a warning when someone tries to use -f and remove
the "auto-guessing" of file paths.

This script may break people's "scripts on top of get_maintainer"
if they are using -f... but that's the point.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
This is what I had in mind.

CC: joe@perches.com
Cc: geert@linux-m68k.org
Cc: krzk@kernel.org
Cc: netdev@vger.kernel.org
Cc: workflows@vger.kernel.org
Cc: mario.limonciello@amd.com
---
 scripts/get_maintainer.pl | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ab123b498fd9..3635b3d40ebe 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -51,6 +51,7 @@ my $output_roles = 0;
 my $output_rolestats = 1;
 my $output_section_maxlen = 50;
 my $scm = 0;
+my $silence_file_warning = 0;
 my $tree = 1;
 my $web = 0;
 my $subsystem = 0;
@@ -267,6 +268,7 @@ if (!GetOptions(
 		'subsystem!' => \$subsystem,
 		'status!' => \$status,
 		'scm!' => \$scm,
+		'silence-file-warning!' => \$silence_file_warning,
 		'tree!' => \$tree,
 		'web!' => \$web,
 		'letters=s' => \$letters,
@@ -544,7 +546,13 @@ foreach my $file (@ARGV) {
     if ($from_filename && (vcs_exists() && !vcs_file_exists($file))) {
 	warn "$P: file '$file' not found in version control $!\n";
     }
-    if ($from_filename || ($file ne "&STDIN" && vcs_file_exists($file))) {
+    if ($from_filename) {
+	if (!$silence_file_warning) {
+	    warn "$P: WARNING: Prefer running the script on patches as "
+	        . "generated by git format-patch. Selecting paths is known "
+		. "to miss recipients!\n";
+	}
+
 	$file =~ s/^\Q${cur_path}\E//;	#strip any absolute path
 	$file =~ s/^\Q${lk_path}\E//;	#or the path to the lk tree
 	push(@files, $file);
@@ -1081,6 +1089,7 @@ version: $V
   --mailmap => use .mailmap file (default: $email_use_mailmap)
   --no-tree => run without a kernel tree
   --self-test => show potential issues with MAINTAINERS file content
+  --silence-file-warning => silence the warning about -f being used (see Notes)
   --version => show version
   --help => show this help information
 
@@ -1089,6 +1098,10 @@ version: $V
    --pattern-depth=0 --remove-duplicates --rolestats]
 
 Notes:
+  Using "-f file" is generally discouraged, running the script on a filepatch
+      (as generated by git format-patch) is usually the right thing to do.
+      Commit message is an integral part of the change and $P
+      will extract additional information from it (keywords, Fixes tags etc.)
   Using "-f directory" may give unexpected results:
       Used with "--git", git signators for _all_ files in and below
           directory are examined as git recurses directories.
-- 
2.41.0


  reply	other threads:[~2023-07-25 15:59 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21  6:26 [Enable Designware XGMAC VLAN Stripping Feature 0/2] Boon, Khai, Ng <boon.khai.ng
2023-07-21  6:26 ` Boon, Khai, Ng <boon.khai.ng
2023-07-21  6:26 ` [Enable Designware XGMAC VLAN Stripping Feature 1/2] dt-bindings: net: snps,dwmac: Add description for rx-vlan-offload Boon, Khai, Ng <boon.khai.ng
2023-07-21  6:26   ` Boon, Khai, Ng <boon.khai.ng
2023-07-21 10:10   ` Krzysztof Kozlowski
2023-07-21 10:10     ` Krzysztof Kozlowski
2023-07-21 15:28     ` Ng, Boon Khai
2023-07-21 15:28       ` Ng, Boon Khai
2023-07-21 16:21       ` Krzysztof Kozlowski
2023-07-21 16:21         ` Krzysztof Kozlowski
2023-07-21 16:33         ` Ng, Boon Khai
2023-07-21 16:33           ` Ng, Boon Khai
2023-07-22  1:55         ` Jakub Kicinski
2023-07-22  1:55           ` Jakub Kicinski
2023-07-22  3:32           ` Joe Perches
2023-07-22  3:32             ` Joe Perches
2023-07-25  1:04             ` Jakub Kicinski
2023-07-25  3:53               ` Joe Perches
2023-07-25  7:33                 ` Geert Uytterhoeven
2023-07-25 13:19                   ` Mario Limonciello
2023-07-25 13:43                     ` Joe Perches
2023-07-25 14:37                       ` Krzysztof Kozlowski
2023-07-25 15:59                         ` Jakub Kicinski [this message]
2023-07-25 16:53                           ` [PATCH] scripts: checkpatch: steer people away from using file paths Greg KH
2023-07-25 17:10                             ` Jakub Kicinski
2023-07-25 17:25                               ` Greg KH
2023-07-25 19:52                                 ` Jakub Kicinski
2023-07-25 21:01                                   ` Joe Perches
2023-07-25 16:57                           ` Krzysztof Kozlowski
2023-07-25 21:18                           ` Joe Perches
2023-07-25 22:15                             ` Jakub Kicinski
2023-07-26  6:28                               ` Joe Perches
2023-07-21 16:26       ` [Enable Designware XGMAC VLAN Stripping Feature 1/2] dt-bindings: net: snps,dwmac: Add description for rx-vlan-offload Krzysztof Kozlowski
2023-07-21 16:26         ` Krzysztof Kozlowski
2023-07-21 16:39         ` Ng, Boon Khai
2023-07-21 16:39           ` Ng, Boon Khai
2023-07-21 10:17   ` Shevchenko Andriy
2023-07-21 10:17     ` Shevchenko Andriy
2023-07-21 10:17     ` Shevchenko Andriy
2023-07-21 15:35     ` Ng, Boon Khai
2023-07-21 15:35       ` Ng, Boon Khai
2023-07-21 15:48       ` Shevchenko, Andriy
2023-07-21 15:48         ` Shevchenko, Andriy
2023-07-21 15:51         ` Ng, Boon Khai
2023-07-21 15:51           ` Ng, Boon Khai
2023-07-21  6:26 ` [Enable Designware XGMAC VLAN Stripping Feature 2/2] net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN Stripping Boon, Khai, Ng <boon.khai.ng
2023-07-21  6:26   ` Boon, Khai, Ng <boon.khai.ng
2023-07-21 10:11   ` Krzysztof Kozlowski
2023-07-21 10:11     ` Krzysztof Kozlowski
2023-07-21 15:30     ` Ng, Boon Khai
2023-07-21 15:30       ` Ng, Boon Khai
2023-07-21 15:59       ` Florian Fainelli
2023-07-21 15:59         ` Florian Fainelli
2023-07-21 16:12         ` Ng, Boon Khai
2023-07-21 16:12           ` Ng, Boon Khai
2023-07-21 16:29           ` Florian Fainelli
2023-07-21 16:29             ` Florian Fainelli
2023-07-21 16:45             ` Ng, Boon Khai
2023-07-21 16:45               ` Ng, Boon Khai
2023-07-21 16:22         ` Krzysztof Kozlowski
2023-07-21 16:22           ` Krzysztof Kozlowski
2023-07-21 16:22       ` Krzysztof Kozlowski
2023-07-21 16:22         ` Krzysztof Kozlowski

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=20230725155926.2775416-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=joe@perches.com \
    --cc=krzk@kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=workflows@vger.kernel.org \
    /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.