summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2019-03-08 03:28:32 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-08 05:32:00 +0300
commitfdf13693d370653013eec3bc7f80a3f535001bf0 (patch)
tree4c058ea6475ee9f1210cabae956f63fe3a254fd8 /scripts/checkpatch.pl
parent488cf83380b72270b70a80de1eaff53899b1febb (diff)
downloadlinux-fdf13693d370653013eec3bc7f80a3f535001bf0.tar.xz
checkpatch: verify SPDX comment style
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. Link: http://lkml.kernel.org/r/8b02899853247a2c67669561761f354dd3bd110e.camel@perches.com Signed-off-by: Joe Perches <joe@perches.com> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..c17cbc06911f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3037,6 +3037,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",