All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Leemhuis <linux@leemhuis.info>
To: Joe Perches <joe@perches.com>, Andy Whitcroft <apw@canonical.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: "Kai Wasserbäch" <kai@dev.carbon-project.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v4 1/3] checkpatch: warn when unknown tags are used for links
Date: Fri, 20 Jan 2023 13:35:18 +0100	[thread overview]
Message-ID: <3b036087d80b8c0e07a46a1dbaaf4ad0d018f8d5.1674217480.git.linux@leemhuis.info> (raw)
In-Reply-To: <cover.1674217480.git.linux@leemhuis.info>

From: Kai Wasserbäch <kai@dev.carbon-project.org>

Issue a warning when encountering URLs behind unknown tags, as Linus
recently stated ```please stop making up random tags that make no sense.
Just use "Link:"```[1]. That statement was triggered by an use of
'BugLink', but that's not the only tag people invented:

$ git log -100000 --no-merges --format=email -P \
   --grep='^\w+:[ \t]*http' | grep -Poh '^\w+:[ \t]*http' | \
  sort | uniq -c | sort -rn | head -n 20
 103958 Link: http
    418 BugLink: http
    372 Patchwork: http
    280 Closes: http
    224 Bug: http
    123 References: http
     84 Bugzilla: http
     61 URL: http
     42 v1: http
     38 Datasheet: http
     20 v2: http
      9 Ref: http
      9 Fixes: http
      9 Buglink: http
      8 v3: http
      8 Reference: http
      7 See: http
      6 1: http
      5 link: http
      3 Link:http

Some of these non-standard tags make it harder for external tools that
rely on use of proper tags. One of those tools is the regression
tracking bot 'regzbot', which looks out for "Link:" tags pointing to
reports of tracked regressions.

The initial idea was to use a disallow list to raise an error when
encountering known unwanted tags like BugLink:; during review it was
requested to use a list of allowed tags instead[2].

Link: https://lore.kernel.org/all/CAHk-=wgs38ZrfPvy=nOwVkVzjpM3VFU1zobP37Fwd_h9iAD5JQ@mail.gmail.com/ [1]
Link: https://lore.kernel.org/all/15f7df96d49082fb7799dda6e187b33c84f38831.camel@perches.com/ [2]
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Co-developed-by: Thorsten Leemhuis <linux@leemhuis.info>
Signed-off-by: Thorsten Leemhuis <linux@leemhuis.info>
---
 scripts/checkpatch.pl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 78cc595b98ce..d739ce0909b1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3250,6 +3250,18 @@ sub process {
 			$commit_log_possible_stack_dump = 0;
 		}
 
+# Check for odd tags before a URI/URL
+		if ($in_commit_log &&
+		    $line =~ /^\s*(\w+):\s*http/ && $1 ne 'Link') {
+			if ($1 =~ /^v(?:ersion)?\d+/i) {
+				WARN("COMMIT_LOG_VERSIONING",
+				     "Patch version information should be after the --- line\n" . $herecurr);
+			} else {
+				WARN("COMMIT_LOG_USE_LINK",
+				     "Unknown link reference '$1:', use 'Link:' instead\n" . $herecurr);
+			}
+		}
+
 # Check for lines starting with a #
 		if ($in_commit_log && $line =~ /^#/) {
 			if (WARN("COMMIT_COMMENT_SYMBOL",
-- 
2.39.0


  reply	other threads:[~2023-01-20 12:35 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04 11:33 [PATCH 0/2] feat: checkpatch: prohibit Buglink: and warn about missing Link: Kai Wasserbäch
2022-12-04 11:33 ` [PATCH 1/2] feat: checkpatch: error on usage of a Buglink tag in the commit log Kai Wasserbäch
2022-12-04 11:33 ` [PATCH 2/2] feat: checkpatch: Warn about Reported-by: not being followed by a Link: Kai Wasserbäch
2022-12-08 19:32 ` [PATCH 1/2] checkpatch: warn when unknown tags are used for links Kai Wasserbäch
2022-12-08 19:58   ` Joe Perches
2022-12-09  9:33     ` Thorsten Leemhuis
2022-12-09 16:57       ` Joe Perches
2022-12-08 19:32 ` [PATCH 2/2] checkpatch: warn when Reported-by: is not followed by Link: Kai Wasserbäch
2022-12-08 20:21   ` Joe Perches
2022-12-08 21:11     ` Thorsten Leemhuis
2022-12-08 21:34       ` Joe Perches
2022-12-09  8:33         ` Thorsten Leemhuis
2022-12-09  9:54     ` Thorsten Leemhuis
2022-12-09 17:00       ` Joe Perches
2022-12-15 14:43 ` [PATCH 0/3, v3] feat: checkpatch: warn about dicouraged link tags and missing links Kai Wasserbäch
2022-12-15 14:43   ` [PATCH 1/3] checkpatch: warn when unknown tags are used for links Kai Wasserbäch
2022-12-15 14:43   ` [PATCH 2/3] checkpatch: warn when Reported-by: is not followed by Link: Kai Wasserbäch
2022-12-15 18:00     ` Joe Perches
2022-12-18 14:54       ` Thorsten Leemhuis
2022-12-15 14:43   ` [PATCH 3/3] checkpatch: use proper way for show problematic line Kai Wasserbäch
2023-01-20 12:35 ` [PATCH v4 0/3] checkpatch.pl: warn about discouraged tags and missing Link: tags Thorsten Leemhuis
2023-01-20 12:35   ` Thorsten Leemhuis [this message]
2023-02-27 13:25     ` [PATCH v4 1/3] checkpatch: warn when unknown tags are used for links Matthieu Baerts
2023-03-02  5:36       ` Thorsten Leemhuis
2023-01-20 12:35   ` [PATCH v4 2/3] checkpatch: warn when Reported-by: is not followed by Link: Thorsten Leemhuis
2023-03-02  4:46     ` Jakub Kicinski
2023-03-02  5:17       ` Thorsten Leemhuis
2023-03-02  5:40         ` Jakub Kicinski
2023-03-02  8:27           ` Dmitry Vyukov
2023-03-02  9:04             ` Thorsten Leemhuis
2023-03-02  9:11               ` Dmitry Vyukov
2023-03-02  9:48                 ` Thorsten Leemhuis
2023-03-03  2:10                   ` Andrew Morton
2023-03-06  8:53                     ` Dmitry Vyukov
2023-03-07 11:36                       ` Thorsten Leemhuis
2023-01-20 12:35   ` [PATCH v4 3/3] checkpatch: use proper way for show problematic line Thorsten Leemhuis
2023-01-20 15:20   ` [PATCH v4 0/3] checkpatch.pl: warn about discouraged tags and missing Link: tags Joe Perches

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=3b036087d80b8c0e07a46a1dbaaf4ad0d018f8d5.1674217480.git.linux@leemhuis.info \
    --to=linux@leemhuis.info \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=kai@dev.carbon-project.org \
    --cc=linux-kernel@vger.kernel.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.