rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] scripts/checkpatch.pl: check for non-permalinks to Zulip
@ 2024-08-27 18:43 Siddharth Menon
  2024-08-28  9:27 ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: Siddharth Menon @ 2024-08-27 18:43 UTC (permalink / raw)
  To: rust-for-linux
  Cc: linux-kernel, linux-kernel-mentees, apw, joe, Miguel Ojeda,
	Siddharth Menon

Zulip links to https://rust-for-linux.zulipchat.com can break in
case of renaming the topic or channel if they are not message
links (which are permanent links).

If a non-permanent Zulip link is referenced then emit a warning
and direct the user to the Zulip documentation.

Permanent links are of the format:
https://.../#narrow/stream/x/topic/x/near/<numerical_id>

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1104
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
V1->V2:
Corrected the Github link to the right issue,
Fixed grammatical errors and Replaced the link to reference 
Documentation to one that is easier to understand.

 scripts/checkpatch.pl | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 39032224d504..41630532a056 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -735,6 +735,10 @@ our $obsolete_archives = qr{(?xi:
 	\Qspinics.net\E
 )};
 
+our $zulip_forums = qr{(?xi:
+	\Qrust-for-linux.zulipchat.com\E
+)};
+
 our @typeListMisordered = (
 	qr{char\s+(?:un)?signed},
 	qr{int\s+(?:(?:un)?signed\s+)?short\s},
@@ -3415,6 +3419,12 @@ sub process {
 			     "Use lore.kernel.org archive links when possible - see https://lore.kernel.org/lists.html\n" . $herecurr);
 		}
 
+# Check for permanent Zulip URL
+		if ($rawline =~ m{http.*\b$zulip_forums(?!(?:/#narrow/stream/.+/topic/.+/(?:near|with)/\d+)?($|\s+.*))}) {
+			WARN("PREFER_PERMANENT_URL",
+			     "Use permanent Zulip links when possible - see https://zulip.com/help/link-to-a-message-or-conversation\n" . $herecurr);
+		}
+
 # Check for added, moved or deleted files
 		if (!$reported_maintainer_file && !$in_commit_log &&
 		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
-- 
2.39.2


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

* Re: [PATCH V2] scripts/checkpatch.pl: check for non-permalinks to Zulip
  2024-08-27 18:43 [PATCH V2] scripts/checkpatch.pl: check for non-permalinks to Zulip Siddharth Menon
@ 2024-08-28  9:27 ` Miguel Ojeda
  0 siblings, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2024-08-28  9:27 UTC (permalink / raw)
  To: Siddharth Menon
  Cc: rust-for-linux, linux-kernel, linux-kernel-mentees, apw, joe,
	Miguel Ojeda

On Tue, Aug 27, 2024 at 8:44 PM Siddharth Menon <simeddon@gmail.com> wrote:
>
> Zulip links to https://rust-for-linux.zulipchat.com can break in
> case of renaming the topic or channel if they are not message
> links (which are permanent links).
>
> If a non-permanent Zulip link is referenced then emit a warning
> and direct the user to the Zulip documentation.
>
> Permanent links are of the format:
> https://.../#narrow/stream/x/topic/x/near/<numerical_id>
>
> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1104
> Signed-off-by: Siddharth Menon <simeddon@gmail.com>

This looks better, thanks!

> +                            "Use permanent Zulip links when possible - see https://zulip.com/help/link-to-a-message-or-conversation\n" . $herecurr);

That link is better, yeah.

It may still be a bit confusing (one needs to search for "permalink"
inside the page), but perhaps Zulip will improve those when they
introduce more permalinks (?).

I guess we could link directly to the section at
https://zulip.com/help/link-to-a-message-or-conversation#get-a-link-to-a-specific-message
-- it may help a bit.

We could also explain how to shorten the links if the line is very
long, but that is probably best left for another patch (possibly
another warning).

Cheers,
Miguel

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

* [PATCH V2] scripts/checkpatch.pl: check for non-permalinks to Zulip
@ 2024-08-28 21:33 Siddharth Menon
  0 siblings, 0 replies; 3+ messages in thread
From: Siddharth Menon @ 2024-08-28 21:33 UTC (permalink / raw)
  To: rust-for-linux
  Cc: linux-kernel, linux-kernel-mentees, apw, joe, Miguel Ojeda,
	Siddharth Menon

Zulip links to https://rust-for-linux.zulipchat.com can break in
case of renaming the topic or channel if they are not message
links (which are permanent links).

If a non-permanent Zulip link is referenced then emit a warning
and direct the user to the Zulip documentation.

Permanent links are of the format:
https://.../#narrow/stream/x/topic/x/near/<numerical_id>

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1104
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
V1->V2:
Corrected the Github link to the right issue,
Fixed grammatical errors and Replaced the link to reference 
Documentation to one that is easier to understand.

 scripts/checkpatch.pl | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 39032224d504..41630532a056 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -735,6 +735,10 @@ our $obsolete_archives = qr{(?xi:
 	\Qspinics.net\E
 )};
 
+our $zulip_forums = qr{(?xi:
+	\Qrust-for-linux.zulipchat.com\E
+)};
+
 our @typeListMisordered = (
 	qr{char\s+(?:un)?signed},
 	qr{int\s+(?:(?:un)?signed\s+)?short\s},
@@ -3415,6 +3419,12 @@ sub process {
 			     "Use lore.kernel.org archive links when possible - see https://lore.kernel.org/lists.html\n" . $herecurr);
 		}
 
+# Check for permanent Zulip URL
+		if ($rawline =~ m{http.*\b$zulip_forums(?!(?:/#narrow/stream/.+/topic/.+/(?:near|with)/\d+)?($|\s+.*))}) {
+			WARN("PREFER_PERMANENT_URL",
+			     "Use permanent Zulip links when possible - see https://zulip.com/help/link-to-a-message-or-conversation\n" . $herecurr);
+		}
+
 # Check for added, moved or deleted files
 		if (!$reported_maintainer_file && !$in_commit_log &&
 		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
-- 
2.39.2


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

end of thread, other threads:[~2024-08-28 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 18:43 [PATCH V2] scripts/checkpatch.pl: check for non-permalinks to Zulip Siddharth Menon
2024-08-28  9:27 ` Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2024-08-28 21:33 Siddharth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).