qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] checkpatch: Flag suspicious attribution lines
@ 2019-02-04 22:55 Eric Blake
  2019-02-04 23:29 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2019-02-04 22:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, qemu-trivial

Flag commit attribution tags that are unusual (often because they
were a typo), but only as a warning (because sometimes a humorous
or otherwise useful tag is intentionally supplied).

This picks the 6-most popular tags, each with 700 or more uses (well,
S-o-b was already checked for case-sensitivity and typos, leaving
only 5 new tags being checked), as determined by:
$ git log | sed -n 's/^ *\([A-Za-z-]*-by:\).*/\1/p' | \
  sort | uniq -c | sort -k1,1n | tail

Most of the rejected lines were obvious typos (among others, we've
had 4 cases of someone being burnt, based on Singed-off-by; and 2
cases of list-reading via an e-reader, based on eviewed-by; there
are also lines forgetting a space after the ':') or otherwise
tongue-in-check (3 Approximately-suggested-by). A few lines not
whitelisted here may be legitimate, but as they are orders of
magnitude rarer, it is therefore not worth worrying about
(7 Requested-by, 3 Co-authored-by, 1 Inspired-by, etc.).

Signed-off-by: Eric Blake <eblake@redhat.com>
---

v2: fix regex

 scripts/checkpatch.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 88682cb0a9f..4962f74eec1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1456,7 +1456,7 @@ sub process {
 		    ERROR("Author email address is mangled by the mailing list\n" . $herecurr);
 		}

-#check the patch for a signoff:
+#check the patch for a signoff, and that other attribution lines are typical:
 		if ($line =~ /^\s*signed-off-by:/i) {
 			# This is a signoff, if ugly, so do not double report.
 			$signoff++;
@@ -1470,6 +1470,10 @@ sub process {
 				ERROR("space required after Signed-off-by:\n" .
 					$herecurr);
 			}
+		} elsif($line =~ /^\s*([A-Za-z-]*)-by:/ &&
+			($1 !~ /(Suggest|Report|Test|Ack|Review)ed/ ||
+			 $line !~ /^\s*[a-z-]*-by:\s/i)) {
+		    WARN("suspicious attribution tag:\n" . $herecurr);
 		}

 # Check if MAINTAINERS is being updated.  If so, there's probably no need to
-- 
2.20.1

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

* Re: [Qemu-devel] [PATCH v2] checkpatch: Flag suspicious attribution lines
  2019-02-04 22:55 [Qemu-devel] [PATCH v2] checkpatch: Flag suspicious attribution lines Eric Blake
@ 2019-02-04 23:29 ` Philippe Mathieu-Daudé
  2019-02-05  2:14   ` Eric Blake
  2019-02-05  9:02   ` Cornelia Huck
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-04 23:29 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-trivial, peter.maydell

On 2/4/19 11:55 PM, Eric Blake wrote:
> Flag commit attribution tags that are unusual (often because they
> were a typo), but only as a warning (because sometimes a humorous
> or otherwise useful tag is intentionally supplied).
> 
> This picks the 6-most popular tags, each with 700 or more uses (well,
> S-o-b was already checked for case-sensitivity and typos, leaving
> only 5 new tags being checked), as determined by:
> $ git log | sed -n 's/^ *\([A-Za-z-]*-by:\).*/\1/p' | \
>   sort | uniq -c | sort -k1,1n | tail
> 
> Most of the rejected lines were obvious typos (among others, we've
> had 4 cases of someone being burnt, based on Singed-off-by; and 2
> cases of list-reading via an e-reader, based on eviewed-by; there
> are also lines forgetting a space after the ':') or otherwise
> tongue-in-check (3 Approximately-suggested-by). A few lines not
> whitelisted here may be legitimate, but as they are orders of
> magnitude rarer, it is therefore not worth worrying about
> (7 Requested-by, 3 Co-authored-by, 1 Inspired-by, etc.).

'Inspired-by' is kinda Zen :) And is from Peter!

> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> 
> v2: fix regex
> 
>  scripts/checkpatch.pl | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 88682cb0a9f..4962f74eec1 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1456,7 +1456,7 @@ sub process {
>  		    ERROR("Author email address is mangled by the mailing list\n" . $herecurr);
>  		}
> 
> -#check the patch for a signoff:
> +#check the patch for a signoff, and that other attribution lines are typical:
>  		if ($line =~ /^\s*signed-off-by:/i) {
>  			# This is a signoff, if ugly, so do not double report.
>  			$signoff++;
> @@ -1470,6 +1470,10 @@ sub process {
>  				ERROR("space required after Signed-off-by:\n" .
>  					$herecurr);
>  			}
> +		} elsif($line =~ /^\s*([A-Za-z-]*)-by:/ &&

I guess we don't mind about angry typewriters who Ack-BY ;)

> +			($1 !~ /(Suggest|Report|Test|Ack|Review)ed/ ||
> +			 $line !~ /^\s*[a-z-]*-by:\s/i)) {

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +		    WARN("suspicious attribution tag:\n" . $herecurr);
>  		}
> 
>  # Check if MAINTAINERS is being updated.  If so, there's probably no need to
> 

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

* Re: [Qemu-devel] [PATCH v2] checkpatch: Flag suspicious attribution lines
  2019-02-04 23:29 ` Philippe Mathieu-Daudé
@ 2019-02-05  2:14   ` Eric Blake
  2019-02-05  9:02   ` Cornelia Huck
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2019-02-05  2:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: qemu-trivial, peter.maydell

[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]

On 2/4/19 5:29 PM, Philippe Mathieu-Daudé wrote:
> On 2/4/19 11:55 PM, Eric Blake wrote:
>> Flag commit attribution tags that are unusual (often because they
>> were a typo), but only as a warning (because sometimes a humorous
>> or otherwise useful tag is intentionally supplied).
>>
>> This picks the 6-most popular tags, each with 700 or more uses (well,
>> S-o-b was already checked for case-sensitivity and typos, leaving
>> only 5 new tags being checked), as determined by:
>> $ git log | sed -n 's/^ *\([A-Za-z-]*-by:\).*/\1/p' | \
>>   sort | uniq -c | sort -k1,1n | tail

Use of [bB][yY] finds a few more interesting spellings...

>>
>> Most of the rejected lines were obvious typos (among others, we've
>> had 4 cases of someone being burnt, based on Singed-off-by; and 2
>> cases of list-reading via an e-reader, based on eviewed-by; there
>> are also lines forgetting a space after the ':') or otherwise
>> tongue-in-check (3 Approximately-suggested-by). A few lines not
>> whitelisted here may be legitimate, but as they are orders of
>> magnitude rarer, it is therefore not worth worrying about
>> (7 Requested-by, 3 Co-authored-by, 1 Inspired-by, etc.).

Among others, 48 Reviewed-By.


>> @@ -1470,6 +1470,10 @@ sub process {
>>  				ERROR("space required after Signed-off-by:\n" .
>>  					$herecurr);
>>  			}
>> +		} elsif($line =~ /^\s*([A-Za-z-]*)-by:/ &&
> 
> I guess we don't mind about angry typewriters who Ack-BY ;)

I can send a v3 that makes this line case-insensitive,

> 
>> +			($1 !~ /(Suggest|Report|Test|Ack|Review)ed/ ||
>> +			 $line !~ /^\s*[a-z-]*-by:\s/i)) {

although making this line require lower-case '-by' gets a bit trickier.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Qemu-devel] [PATCH v2] checkpatch: Flag suspicious attribution lines
  2019-02-04 23:29 ` Philippe Mathieu-Daudé
  2019-02-05  2:14   ` Eric Blake
@ 2019-02-05  9:02   ` Cornelia Huck
  1 sibling, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2019-02-05  9:02 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eric Blake, qemu-devel, qemu-trivial, peter.maydell

On Tue, 5 Feb 2019 00:29:14 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On 2/4/19 11:55 PM, Eric Blake wrote:
> > Flag commit attribution tags that are unusual (often because they
> > were a typo), but only as a warning (because sometimes a humorous
> > or otherwise useful tag is intentionally supplied).
> > 
> > This picks the 6-most popular tags, each with 700 or more uses (well,
> > S-o-b was already checked for case-sensitivity and typos, leaving
> > only 5 new tags being checked), as determined by:
> > $ git log | sed -n 's/^ *\([A-Za-z-]*-by:\).*/\1/p' | \
> >   sort | uniq -c | sort -k1,1n | tail
> > 
> > Most of the rejected lines were obvious typos (among others, we've
> > had 4 cases of someone being burnt, based on Singed-off-by; and 2
> > cases of list-reading via an e-reader, based on eviewed-by; there
> > are also lines forgetting a space after the ':') or otherwise
> > tongue-in-check (3 Approximately-suggested-by). A few lines not
> > whitelisted here may be legitimate, but as they are orders of
> > magnitude rarer, it is therefore not worth worrying about
> > (7 Requested-by, 3 Co-authored-by, 1 Inspired-by, etc.).  

Hm, wasn't Co-authored-by: actually intended to cover the cases where
someone else did write significant parts of the patch? (I cannot point
to the source without searching, though...)

> 
> 'Inspired-by' is kinda Zen :) And is from Peter!

I also like that one :)

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

end of thread, other threads:[~2019-02-05  9:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-04 22:55 [Qemu-devel] [PATCH v2] checkpatch: Flag suspicious attribution lines Eric Blake
2019-02-04 23:29 ` Philippe Mathieu-Daudé
2019-02-05  2:14   ` Eric Blake
2019-02-05  9:02   ` Cornelia Huck

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).