[PATCH] checkpatch: Verify SPDX comment style

From: Joe Perches
Date: Thu Jan 10 2019 - 19:05:17 EST


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@xxxxxxxxxxx>
---
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",