[2/2] checkpatch: Improve SPDX license checking
diff mbox series

Message ID f08eb62458407a145cfedf959d1091af151cd665.1563575364.git.joe@perches.com
State In Next
Commit b7aa354c8235a5d22af9cf61abe0e1086f48a419
Headers show
Series
  • [1/2] checkpatch: Don't interpret stack dumps as commit IDs
Related show

Commit Message

Joe Perches July 19, 2019, 10:31 p.m. UTC
Use perl's m@<match>@ match and not /<match>/ comparisons to avoid
an error using c90's // comment style.

Miscellanea:

o Use normal tab indentation and alignment

Link: http://lkml.kernel.org/r/5e4a8fa7901148fbcd77ab391e6dd0e6bf95777f.camel@perches.com

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

This replaces the unsigned patch with an incomplete commit description
in -next.

scripts/checkpatch.pl | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Stephen Rothwell July 20, 2019, 2:22 a.m. UTC | #1
Hi Joe,

On Fri, 19 Jul 2019 15:31:33 -0700 Joe Perches <joe@perches.com> wrote:
>
> Use perl's m@<match>@ match and not /<match>/ comparisons to avoid
> an error using c90's // comment style.
> 
> Miscellanea:
> 
> o Use normal tab indentation and alignment
> 
> Link: http://lkml.kernel.org/r/5e4a8fa7901148fbcd77ab391e6dd0e6bf95777f.camel@perches.com
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

Again, don't include other's (non author's) SOB lines.
Joe Perches July 20, 2019, 3:09 a.m. UTC | #2
On Sat, 2019-07-20 at 12:22 +1000, Stephen Rothwell wrote:
> Hi Joe,
> 
> On Fri, 19 Jul 2019 15:31:33 -0700 Joe Perches <joe@perches.com> wrote:
> > Use perl's m@<match>@ match and not /<match>/ comparisons to avoid
> > an error using c90's // comment style.
> > 
> > Miscellanea:
> > 
> > o Use normal tab indentation and alignment
> > 
> > Link: http://lkml.kernel.org/r/5e4a8fa7901148fbcd77ab391e6dd0e6bf95777f.camel@perches.com
> > 
> > Signed-off-by: Joe Perches <joe@perches.com>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> 
> Again, don't include other's (non author's) SOB lines.

Nope.
You _already_ signed-off this patch.
I'm simply reproducing it.
Stephen Rothwell July 20, 2019, 3:17 a.m. UTC | #3
Hi Joe,

On Fri, 19 Jul 2019 20:09:19 -0700 Joe Perches <joe@perches.com> wrote:
>
> On Sat, 2019-07-20 at 12:22 +1000, Stephen Rothwell wrote:
> > Hi Joe,
> > 
> > On Fri, 19 Jul 2019 15:31:33 -0700 Joe Perches <joe@perches.com> wrote:  
> > > Use perl's m@<match>@ match and not /<match>/ comparisons to avoid
> > > an error using c90's // comment style.
> > > 
> > > Miscellanea:
> > > 
> > > o Use normal tab indentation and alignment
> > > 
> > > Link: http://lkml.kernel.org/r/5e4a8fa7901148fbcd77ab391e6dd0e6bf95777f.camel@perches.com
> > > 
> > > Signed-off-by: Joe Perches <joe@perches.com>
> > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>  
> > 
> > Again, don't include other's (non author's) SOB lines.  
> 
> Nope.
> You _already_ signed-off this patch.
> I'm simply reproducing it.

My SOB line is *only* there because I am publishing that patch in
linux-next.  When Andrew sends that patch to Linus, my SOB should not
be there (since I will no longer be in the handling path).  My SOB does
not say anything about the correctness or otherwise of the patch.

Equally, if you sent that patch to Linus, Andrew's SOB should
(probably) not be there.

Patch
diff mbox series

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3c0ee0dde850..6cb99ec62000 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3071,21 +3071,21 @@  sub process {
 # check SPDX comment style for .[chsS] files
 				if ($realfile =~ /\.[chsS]$/ &&
 				    $rawline =~ /SPDX-License-Identifier:/ &&
-				    $rawline !~ /^\+\s*\Q$comment\E\s*/) {
+				    $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
 					WARN("SPDX_LICENSE_TAG",
 					     "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
 				}
 
 				if ($comment !~ /^$/ &&
-				    $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {
-					 WARN("SPDX_LICENSE_TAG",
-					      "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
+				    $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
+					WARN("SPDX_LICENSE_TAG",
+					     "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
 				} elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
-					 my $spdx_license = $1;
-					 if (!is_SPDX_License_valid($spdx_license)) {
-						  WARN("SPDX_LICENSE_TAG",
-						       "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
-					 }
+					my $spdx_license = $1;
+					if (!is_SPDX_License_valid($spdx_license)) {
+						WARN("SPDX_LICENSE_TAG",
+						     "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
+					}
 				}
 			}
 		}