Re: [PATCH 1/2] checkpatch: warn when unknown tags are used for links

From: Thorsten Leemhuis
Date: Fri Dec 09 2022 - 04:33:24 EST


On 08.12.22 20:58, Joe Perches wrote:
> On Thu, 2022-12-08 at 20:32 +0100, Kai Wasserbäch wrote:
>> 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 --format=email -P --grep='^\w+:[ \t]*http' | \
>
> Please use the --no-merges output

Done, good point.

> [...]
>> @@ -3239,6 +3239,13 @@ 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 !~ /^Link/) {
>> + WARN("COMMIT_LOG_USE_LINK",
>> + "Unknown link reference '$1:', use 'Link:' instead.\n" . $herecurr);
>
> This would allow LinkFoo: so better would be
>
> $line =~ /^\s*(\w+):\s*http/ && $1 ne 'Link')
> or
> $line =~ /^\s*(\w+):\s*http/ && $1 !~ /^Link$/) {
>
> (and checkpatch doesn't use periods after output messages)
>
> Maybe better as well would be to use something like the below to
> better describe the preferred location of patch versioning info.
>
> # 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);
> }
> }
>

Yeah, that looks like a really good idea. I went with that. But I'd say
this is the point where this really warrants a Co-developed-by: that
mentions you (and thus a Signed-off-by: from your side, too), don't you
think so?

Ciao, Thorsten