public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add check for tag Co-Developed-by
@ 2017-12-07  0:59 Tobin C. Harding
  2017-12-07  6:34 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tobin C. Harding @ 2017-12-07  0:59 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Tobin C. Harding, linux-kernel, Greg Kroah-Hartman

Recently signature tag Co-Developed-by was added to the
kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
about it yet. All prior tags used all lowercase characters except for first
character. Checks for this format had to be re-worked to allow for the
new tag.

Add checkpatch checks for Co-Developed-by tag.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 scripts/checkpatch.pl | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 040aa79e1d9d..a7d2cdcec6a6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -468,6 +468,7 @@ our $signature_tags = qr{(?xi:
 	Reviewed-by:|
 	Reported-by:|
 	Suggested-by:|
+	Co-Developed-by:|
 	To:|
 	Cc:
 )};
@@ -2468,6 +2469,8 @@ sub process {
 			my $space_after = $3;
 			my $email = $4;
 			my $ucfirst_sign_off = ucfirst(lc($sign_off));
+			my $preferred_signature = "";
+			my $co_dev_by_tag = 'Co-Developed-by:';
 
 			if ($sign_off !~ /$signature_tags/) {
 				WARN("BAD_SIGN_OFF",
@@ -2481,15 +2484,22 @@ sub process {
 					    "$ucfirst_sign_off $email";
 				}
 			}
-			if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) {
-				if (WARN("BAD_SIGN_OFF",
-					 "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr) &&
-				    $fix) {
-					$fixed[$fixlinenr] =
-					    "$ucfirst_sign_off $email";
+			if ($sign_off =~ /$co_dev_by_tag$/i) {
+				if ($sign_off ne $co_dev_by_tag) {
+					$preferred_signature = $co_dev_by_tag;
 				}
+			} elsif ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) {
+				$preferred_signature = $ucfirst_sign_off;
 
 			}
+
+			if ($preferred_signature ne "") {
+				my $prefix = "'$preferred_signature' is the preferred signature form\n";
+				if (WARN("BAD_SIGN_OFF", $prefix . $herecurr) && $fix) {
+					$fixed[$fixlinenr] = "$ucfirst_sign_off $email";
+				}
+			}
+
 			if (!defined $space_after || $space_after ne " ") {
 				if (WARN("BAD_SIGN_OFF",
 					 "Use a single space after $ucfirst_sign_off\n" . $herecurr) &&
-- 
2.7.4

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

* Re: [PATCH] checkpatch: add check for tag Co-Developed-by
  2017-12-07  0:59 [PATCH] checkpatch: add check for tag Co-Developed-by Tobin C. Harding
@ 2017-12-07  6:34 ` Joe Perches
  2017-12-07  6:55   ` Greg Kroah-Hartman
  2017-12-07  6:56 ` Greg Kroah-Hartman
  2017-12-07 16:26 ` Joe Perches
  2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2017-12-07  6:34 UTC (permalink / raw)
  To: Tobin C. Harding, Andy Whitcroft, Andrew Morton
  Cc: linux-kernel, Greg Kroah-Hartman, Thomas Gleixner,
	Borislav Petkov, Jonathan Corbet

On Thu, 2017-12-07 at 11:59 +1100, Tobin C. Harding wrote:
> Recently signature tag Co-Developed-by was added to the
> kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
> about it yet. All prior tags used all lowercase characters except for first
> character. Checks for this format had to be re-worked to allow for the
> new tag.
> 
> Add checkpatch checks for Co-Developed-by tag.
[]
> +++ b/scripts/checkpatch.pl
> @@ -468,6 +468,7 @@ our $signature_tags = qr{(?xi:
>  	Reviewed-by:|
>  	Reported-by:|
>  	Suggested-by:|
> +	Co-Developed-by:|

I think the extra hyphenate form is poor at best.
Codeveloped-by: should be the only form.

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

* Re: [PATCH] checkpatch: add check for tag Co-Developed-by
  2017-12-07  6:34 ` Joe Perches
@ 2017-12-07  6:55   ` Greg Kroah-Hartman
  2017-12-07  6:59     ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-07  6:55 UTC (permalink / raw)
  To: Joe Perches
  Cc: Tobin C. Harding, Andy Whitcroft, Andrew Morton, linux-kernel,
	Thomas Gleixner, Borislav Petkov, Jonathan Corbet

On Wed, Dec 06, 2017 at 10:34:26PM -0800, Joe Perches wrote:
> On Thu, 2017-12-07 at 11:59 +1100, Tobin C. Harding wrote:
> > Recently signature tag Co-Developed-by was added to the
> > kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
> > about it yet. All prior tags used all lowercase characters except for first
> > character. Checks for this format had to be re-worked to allow for the
> > new tag.
> > 
> > Add checkpatch checks for Co-Developed-by tag.
> []
> > +++ b/scripts/checkpatch.pl
> > @@ -468,6 +468,7 @@ our $signature_tags = qr{(?xi:
> >  	Reviewed-by:|
> >  	Reported-by:|
> >  	Suggested-by:|
> > +	Co-Developed-by:|
> 
> I think the extra hyphenate form is poor at best.
> Codeveloped-by: should be the only form.

That's not what Documentation/process/5.Posting.rst says, sorry.

So Tobin's patch is correct.

thanks,

greg k-h

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

* Re: [PATCH] checkpatch: add check for tag Co-Developed-by
  2017-12-07  0:59 [PATCH] checkpatch: add check for tag Co-Developed-by Tobin C. Harding
  2017-12-07  6:34 ` Joe Perches
@ 2017-12-07  6:56 ` Greg Kroah-Hartman
  2017-12-07 16:26 ` Joe Perches
  2 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-07  6:56 UTC (permalink / raw)
  To: Tobin C. Harding; +Cc: Andy Whitcroft, Joe Perches, linux-kernel

On Thu, Dec 07, 2017 at 11:59:36AM +1100, Tobin C. Harding wrote:
> Recently signature tag Co-Developed-by was added to the
> kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
> about it yet. All prior tags used all lowercase characters except for first
> character. Checks for this format had to be re-worked to allow for the
> new tag.
> 
> Add checkpatch checks for Co-Developed-by tag.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Tobin C. Harding <me@tobin.cc>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] checkpatch: add check for tag Co-Developed-by
  2017-12-07  6:55   ` Greg Kroah-Hartman
@ 2017-12-07  6:59     ` Joe Perches
  0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2017-12-07  6:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Tobin C. Harding, Andy Whitcroft, Andrew Morton, linux-kernel,
	Thomas Gleixner, Borislav Petkov, Jonathan Corbet

On Thu, 2017-12-07 at 07:55 +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 06, 2017 at 10:34:26PM -0800, Joe Perches wrote:
> > On Thu, 2017-12-07 at 11:59 +1100, Tobin C. Harding wrote:
> > > Recently signature tag Co-Developed-by was added to the
> > > kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
> > > about it yet. All prior tags used all lowercase characters except for first
> > > character. Checks for this format had to be re-worked to allow for the
> > > new tag.
> > > 
> > > Add checkpatch checks for Co-Developed-by tag.
> > 
> > []
> > > +++ b/scripts/checkpatch.pl
> > > @@ -468,6 +468,7 @@ our $signature_tags = qr{(?xi:
> > >  	Reviewed-by:|
> > >  	Reported-by:|
> > >  	Suggested-by:|
> > > +	Co-Developed-by:|
> > 
> > I think the extra hyphenate form is poor at best.
> > Codeveloped-by: should be the only form.
> 
> That's not what Documentation/process/5.Posting.rst says, sorry.

So what? That's easy to change.

> So Tobin's patch is correct.

Not to me.

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

* Re: [PATCH] checkpatch: add check for tag Co-Developed-by
  2017-12-07  0:59 [PATCH] checkpatch: add check for tag Co-Developed-by Tobin C. Harding
  2017-12-07  6:34 ` Joe Perches
  2017-12-07  6:56 ` Greg Kroah-Hartman
@ 2017-12-07 16:26 ` Joe Perches
  2017-12-07 20:56   ` Tobin C. Harding
  2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2017-12-07 16:26 UTC (permalink / raw)
  To: Tobin C. Harding, Andy Whitcroft; +Cc: linux-kernel, Greg Kroah-Hartman

On Thu, 2017-12-07 at 11:59 +1100, Tobin C. Harding wrote:
> Recently signature tag Co-Developed-by was added to the
> kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
> about it yet. All prior tags used all lowercase characters except for first
> character. Checks for this format had to be re-worked to allow for the
> new tag.
> 
> Add checkpatch checks for Co-Developed-by tag.

This patch is not extensible.

If this is to be done at all, the Co-Developed-by:
should not be a special case because a new and
different one might be added in the future.

Better to verify that a case insensitive match exists
in $signature_tags and then complain if the match is
not exact.

> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Tobin C. Harding <me@tobin.cc>
> ---
>  scripts/checkpatch.pl | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 040aa79e1d9d..a7d2cdcec6a6 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -468,6 +468,7 @@ our $signature_tags = qr{(?xi:
>  	Reviewed-by:|
>  	Reported-by:|
>  	Suggested-by:|
> +	Co-Developed-by:|
>  	To:|
>  	Cc:
>  )};
> @@ -2468,6 +2469,8 @@ sub process {
>  			my $space_after = $3;
>  			my $email = $4;
>  			my $ucfirst_sign_off = ucfirst(lc($sign_off));
> +			my $preferred_signature = "";
> +			my $co_dev_by_tag = 'Co-Developed-by:';
>  
>  			if ($sign_off !~ /$signature_tags/) {
>  				WARN("BAD_SIGN_OFF",
> @@ -2481,15 +2484,22 @@ sub process {
>  					    "$ucfirst_sign_off $email";
>  				}
>  			}
> -			if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) {
> -				if (WARN("BAD_SIGN_OFF",
> -					 "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr) &&
> -				    $fix) {
> -					$fixed[$fixlinenr] =
> -					    "$ucfirst_sign_off $email";
> +			if ($sign_off =~ /$co_dev_by_tag$/i) {
> +				if ($sign_off ne $co_dev_by_tag) {
> +					$preferred_signature = $co_dev_by_tag;
>  				}
> +			} elsif ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) {
> +				$preferred_signature = $ucfirst_sign_off;
>  
>  			}
> +
> +			if ($preferred_signature ne "") {
> +				my $prefix = "'$preferred_signature' is the preferred signature form\n";
> +				if (WARN("BAD_SIGN_OFF", $prefix . $herecurr) && $fix) {
> +					$fixed[$fixlinenr] = "$ucfirst_sign_off $email";
> +				}
> +			}
> +
>  			if (!defined $space_after || $space_after ne " ") {
>  				if (WARN("BAD_SIGN_OFF",
>  					 "Use a single space after $ucfirst_sign_off\n" . $herecurr) &&

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

* Re: [PATCH] checkpatch: add check for tag Co-Developed-by
  2017-12-07 16:26 ` Joe Perches
@ 2017-12-07 20:56   ` Tobin C. Harding
  0 siblings, 0 replies; 7+ messages in thread
From: Tobin C. Harding @ 2017-12-07 20:56 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, linux-kernel, Greg Kroah-Hartman

On Thu, Dec 07, 2017 at 08:26:58AM -0800, Joe Perches wrote:
> On Thu, 2017-12-07 at 11:59 +1100, Tobin C. Harding wrote:
> > Recently signature tag Co-Developed-by was added to the
> > kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know
> > about it yet. All prior tags used all lowercase characters except for first
> > character. Checks for this format had to be re-worked to allow for the
> > new tag.
> > 
> > Add checkpatch checks for Co-Developed-by tag.
> 
> This patch is not extensible.
> 
> If this is to be done at all, the Co-Developed-by:
> should not be a special case because a new and
> different one might be added in the future.

I agree, fixing individual corner cases is bad style.

> Better to verify that a case insensitive match exists
> in $signature_tags and then complain if the match is
> not exact.

I'll have a go at this.

thanks,
Tobin.

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

end of thread, other threads:[~2017-12-07 20:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07  0:59 [PATCH] checkpatch: add check for tag Co-Developed-by Tobin C. Harding
2017-12-07  6:34 ` Joe Perches
2017-12-07  6:55   ` Greg Kroah-Hartman
2017-12-07  6:59     ` Joe Perches
2017-12-07  6:56 ` Greg Kroah-Hartman
2017-12-07 16:26 ` Joe Perches
2017-12-07 20:56   ` Tobin C. Harding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox