public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Tobin C. Harding" <me@tobin.cc>, Andy Whitcroft <apw@canonical.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] checkpatch: add check for tag Co-Developed-by
Date: Thu, 07 Dec 2017 08:26:58 -0800	[thread overview]
Message-ID: <1512664018.960.45.camel@perches.com> (raw)
In-Reply-To: <1512608376-4234-1-git-send-email-me@tobin.cc>

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

  parent reply	other threads:[~2017-12-07 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-12-07 20:56   ` Tobin C. Harding

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=1512664018.960.45.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@tobin.cc \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox