checkpatch: add check for tag Co-Developed-by
PATCH 1/1 checkpatch: add check for tag Co-Developed-by
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.
--- scripts/checkpatch.pl | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
scripts/checkpatch.pl +16 -6
@@ -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) &&
Signature · 1 line
2.7.4
Joe Perches
maintainerQuoted 7 lines · Tobin C. Harding
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.
[]
scripts/checkpatch.pl our $signature_tags = qr{(?xi: · line 471
Quoted 6 lines
+++
b/scripts/checkpatch.plscripts/checkpatch.pl +1
-0@@ -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.
Quoted 9 lines · Joe Perches
Quoted 7 lines · Tobin C. Harding
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.
[]
Quoted 9 lines
scripts/checkpatch.pl our $signature_tags = qr{(?xi: · line 471
Quoted 6 lines
+++
b/scripts/checkpatch.plscripts/checkpatch.pl +1
-0@@ -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
Joe Perches
maintainerQuoted 21 lines · Greg Kroah-Hartman
Quoted 10 lines · Joe Perches
Quoted 7 lines · Tobin C. Harding
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.
[]
Quoted 9 lines
scripts/checkpatch.pl our $signature_tags = qr{(?xi: · line 471
Quoted 6 lines
+++
b/scripts/checkpatch.plscripts/checkpatch.pl +1
-0@@ -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.
Quoted 1 line
That's not what
Documentation/process/5.Posting.rstsays, sorry.
So what? That's easy to change.
Quoted 1 line
So Tobin's patch is correct.
Not to me.
Quoted 10 lines · Tobin C. Harding
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 <[email protected]>Signed-off-by Tobin C. Harding <[email protected]>
Joe Perches
maintainerQuoted 7 lines · Tobin C. Harding
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.
Quoted 56 lines
Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Tobin C. Harding <[email protected]>--- scripts/checkpatch.pl | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)scripts/checkpatch.pl +16
-6@@ -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) &&
Quoted 7 lines · Joe Perches
Quoted 6 lines · Tobin C. Harding
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.
Quoted 7 lines
Quoted 1 line
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.
Quoted 3 lines
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.