linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Verify SPDX comment style
@ 2019-01-11  0:05 Joe Perches
  2019-01-23 11:04 ` Joe Perches
  2019-02-05 22:21 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Perches @ 2019-01-11  0:05 UTC (permalink / raw)
  To: Andrew Morton, Andy Whitcroft; +Cc: Rob Herring, LKML

Using SPDX commenting style // or /* is specified for
various file types in Documentation/process/license-rules.rst
so add an appropriate test for .[chsS] files because many
proposed file additions and patches do not use the correct style.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 155fa9305166..44c2a876be43 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3039,6 +3039,14 @@ sub process {
 					$comment = '..';
 				}
 
+# check SPDX comment style for .[chsS] files
+				if ($realfile =~ /\.[chsS]$/ &&
+				    $rawline =~ /SPDX-License-Identifier:/ &&
+				    $rawline !~ /^\+\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",



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

* Re: [PATCH] checkpatch: Verify SPDX comment style
  2019-01-11  0:05 [PATCH] checkpatch: Verify SPDX comment style Joe Perches
@ 2019-01-23 11:04 ` Joe Perches
  2019-02-05 22:21 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Joe Perches @ 2019-01-23 11:04 UTC (permalink / raw)
  To: Andrew Morton, Andy Whitcroft; +Cc: Rob Herring, LKML

On Thu, 2019-01-10 at 16:05 -0800, Joe Perches wrote:
> Using SPDX commenting style // or /* is specified for
> various file types in Documentation/process/license-rules.rst
> so add an appropriate test for .[chsS] files because many
> proposed file additions and patches do not use the correct style.

ping?



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

* Re: [PATCH] checkpatch: Verify SPDX comment style
  2019-01-11  0:05 [PATCH] checkpatch: Verify SPDX comment style Joe Perches
  2019-01-23 11:04 ` Joe Perches
@ 2019-02-05 22:21 ` Andrew Morton
  2019-02-06  2:21   ` Joe Perches
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2019-02-05 22:21 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, Rob Herring, LKML, Dan Williams

On Thu, 10 Jan 2019 16:05:11 -0800 Joe Perches <joe@perches.com> wrote:

> Using SPDX commenting style // or /* is specified for
> various file types in Documentation/process/license-rules.rst
> so add an appropriate test for .[chsS] files because many
> proposed file additions and patches do not use the correct style.

Dan's
http://lkml.kernel.org/r/154899811738.3165233.12325692939590944259.stgit@dwillia2-desk3.amr.corp.intel.com
is giving me 

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#500: FILE: mm/shuffle.h:1:
+// SPDX-License-Identifier: GPL-2.0

and switching it to /* */ doesn't fix.  This happens with or without
this patch applied.  What to do?


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

* Re: [PATCH] checkpatch: Verify SPDX comment style
  2019-02-05 22:21 ` Andrew Morton
@ 2019-02-06  2:21   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2019-02-06  2:21 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andy Whitcroft, Rob Herring, LKML, Dan Williams

On Tue, 2019-02-05 at 14:21 -0800, Andrew Morton wrote:
> On Thu, 10 Jan 2019 16:05:11 -0800 Joe Perches <joe@perches.com> wrote:
> 
> > Using SPDX commenting style // or /* is specified for
> > various file types in Documentation/process/license-rules.rst
> > so add an appropriate test for .[chsS] files because many
> > proposed file additions and patches do not use the correct style.
> 
> Dan's
> http://lkml.kernel.org/r/154899811738.3165233.12325692939590944259.stgit@dwillia2-desk3.amr.corp.intel.com
> is giving me 
> 
> WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
> #500: FILE: mm/shuffle.h:1:
> +// SPDX-License-Identifier: GPL-2.0
> 
> and switching it to /* */ doesn't fix.  This happens with or without
> this patch applied.  What to do?

Umm, fix checkpatch?

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 37f81fe93c01..216480ae29d1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3053,21 +3053,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);
+					}
 				}
 			}
 		}



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

end of thread, other threads:[~2019-02-06  2:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11  0:05 [PATCH] checkpatch: Verify SPDX comment style Joe Perches
2019-01-23 11:04 ` Joe Perches
2019-02-05 22:21 ` Andrew Morton
2019-02-06  2:21   ` Joe Perches

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