All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: "Jonathan Corbet" <corbet@lwn.net>,
	"Andy Whitcroft" <apw@canonical.com>,
	"Joe Perches" <joe@perches.com>,
	"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
	"Lukas Bulwahn" <lukas.bulwahn@gmail.com>,
	"Kai Wasserbäch" <kai@dev.carbon-project.org>,
	"Thorsten Leemhuis" <linux@leemhuis.info>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Konstantin Ryabitsev" <konstantin@linuxfoundation.org>,
	"Bagas Sanjaya" <bagasdotme@gmail.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	 dri-devel@lists.freedesktop.org, mptcp@lists.linux.dev,
	 Matthieu Baerts <matthieu.baerts@tessares.net>
Subject: [PATCH v3 4/4] checkpatch: check for misuse of the link tags
Date: Thu, 30 Mar 2023 20:13:26 +0200	[thread overview]
Message-ID: <20230314-doc-checkpatch-closes-tag-v3-4-d1bdcf31c71c@tessares.net> (raw)
In-Reply-To: <20230314-doc-checkpatch-closes-tag-v3-0-d1bdcf31c71c@tessares.net>

"Link:" and "Closes:" tags have to be used with public URLs.

It is difficult to make sure the link is public but at least we can
verify the tag is followed by 'http(s):'.

With that, we avoid such a tag that is not allowed [1]:

  Closes: <number>

Link: https://lore.kernel.org/linux-doc/CAHk-=wh0v1EeDV3v8TzK81nDC40=XuTdY2MCr0xy3m3FiBV3+Q@mail.gmail.com/ [1]
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
v3:
- new patch addressing Linus' concerns.
---
 scripts/checkpatch.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ca58c734ff22..e3cafd2cb77a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3292,6 +3292,17 @@ sub process {
 			}
 		}
 
+# Check for misuse of the link tags
+		if ($in_commit_log &&
+		    $line =~ /^\s*(\w+:)\s*(\S+)/) {
+			my $tag = $1;
+			my $value = $2;
+			if ($tag =~ /^$link_tags_search$/ && $value !~ /^https?:/) {
+				WARN("COMMIT_LOG_WRONG_LINK",
+				     "'$tag' should be followed by a public http(s) link\n" . $herecurr);
+			}
+		}
+
 # Check for lines starting with a #
 		if ($in_commit_log && $line =~ /^#/) {
 			if (WARN("COMMIT_COMMENT_SYMBOL",

-- 
2.39.2


WARNING: multiple messages have this Message-ID (diff)
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: "Jonathan Corbet" <corbet@lwn.net>,
	"Andy Whitcroft" <apw@canonical.com>,
	"Joe Perches" <joe@perches.com>,
	"Dwaipayan Ray" <dwaipayanray1@gmail.com>,
	"Lukas Bulwahn" <lukas.bulwahn@gmail.com>,
	"Kai Wasserbäch" <kai@dev.carbon-project.org>,
	"Thorsten Leemhuis" <linux@leemhuis.info>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Konstantin Ryabitsev" <konstantin@linuxfoundation.org>,
	"Bagas Sanjaya" <bagasdotme@gmail.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Cc: Matthieu Baerts <matthieu.baerts@tessares.net>,
	mptcp@lists.linux.dev, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org
Subject: [PATCH v3 4/4] checkpatch: check for misuse of the link tags
Date: Thu, 30 Mar 2023 20:13:26 +0200	[thread overview]
Message-ID: <20230314-doc-checkpatch-closes-tag-v3-4-d1bdcf31c71c@tessares.net> (raw)
In-Reply-To: <20230314-doc-checkpatch-closes-tag-v3-0-d1bdcf31c71c@tessares.net>

"Link:" and "Closes:" tags have to be used with public URLs.

It is difficult to make sure the link is public but at least we can
verify the tag is followed by 'http(s):'.

With that, we avoid such a tag that is not allowed [1]:

  Closes: <number>

Link: https://lore.kernel.org/linux-doc/CAHk-=wh0v1EeDV3v8TzK81nDC40=XuTdY2MCr0xy3m3FiBV3+Q@mail.gmail.com/ [1]
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
v3:
- new patch addressing Linus' concerns.
---
 scripts/checkpatch.pl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ca58c734ff22..e3cafd2cb77a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3292,6 +3292,17 @@ sub process {
 			}
 		}
 
+# Check for misuse of the link tags
+		if ($in_commit_log &&
+		    $line =~ /^\s*(\w+:)\s*(\S+)/) {
+			my $tag = $1;
+			my $value = $2;
+			if ($tag =~ /^$link_tags_search$/ && $value !~ /^https?:/) {
+				WARN("COMMIT_LOG_WRONG_LINK",
+				     "'$tag' should be followed by a public http(s) link\n" . $herecurr);
+			}
+		}
+
 # Check for lines starting with a #
 		if ($in_commit_log && $line =~ /^#/) {
 			if (WARN("COMMIT_COMMENT_SYMBOL",

-- 
2.39.2


  parent reply	other threads:[~2023-03-30 18:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 18:13 [PATCH v3 0/4] docs & checkpatch: allow Closes tags with links Matthieu Baerts
2023-03-30 18:13 ` Matthieu Baerts
2023-03-30 18:13 ` [PATCH v3 1/4] docs: process: " Matthieu Baerts
2023-03-30 18:13   ` Matthieu Baerts
2023-03-30 18:13 ` [PATCH v3 2/4] checkpatch: use a list of "link" tags Matthieu Baerts
2023-03-30 18:13   ` Matthieu Baerts
2023-03-30 18:13 ` [PATCH v3 3/4] checkpatch: allow Closes tags with links Matthieu Baerts
2023-03-30 18:13   ` Matthieu Baerts
2023-03-30 22:43   ` Joe Perches
2023-03-30 22:43     ` Joe Perches
2023-03-31  9:43     ` Matthieu Baerts
2023-03-31  9:43       ` Matthieu Baerts
2023-03-30 18:13 ` Matthieu Baerts [this message]
2023-03-30 18:13   ` [PATCH v3 4/4] checkpatch: check for misuse of the link tags Matthieu Baerts
2023-03-30 19:20   ` checkpatch: check for misuse of the link tags: Tests Results MPTCP CI
2023-03-30 23:31   ` MPTCP CI
2023-03-31  8:57   ` [PATCH v3 4/4] checkpatch: check for misuse of the link tags Thorsten Leemhuis
2023-03-31  8:57     ` Thorsten Leemhuis
2023-03-31  9:44     ` Matthieu Baerts
2023-03-31  9:44       ` Matthieu Baerts
2023-03-31 10:09       ` Thorsten Leemhuis
2023-03-31 10:09         ` Thorsten Leemhuis
2023-03-31 10:16         ` Matthieu Baerts
2023-03-31 10:16           ` Matthieu Baerts
2023-03-31  9:39 ` [PATCH v3 0/4] docs & checkpatch: allow Closes tags with links Thorsten Leemhuis
2023-03-31  9:39   ` Thorsten Leemhuis
2023-03-31 10:08   ` Conor Dooley
2023-03-31 10:08     ` Conor Dooley
2023-03-31 10:34     ` Thorsten Leemhuis
2023-03-31 10:34       ` Thorsten Leemhuis
2023-03-31 10:13   ` Matthieu Baerts
2023-03-31 10:13     ` Matthieu Baerts

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=20230314-doc-checkpatch-closes-tag-v3-4-d1bdcf31c71c@tessares.net \
    --to=matthieu.baerts@tessares.net \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=bagasdotme@gmail.com \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=kai@dev.carbon-project.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=lukas.bulwahn@gmail.com \
    --cc=mptcp@lists.linux.dev \
    --cc=torvalds@linux-foundation.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.