History

checkpatch: improve SPDX license checking

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

Joe Perches committed 7 years ago

Commit ffbce891 parent 634cffc1 file · +9 −9Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+9−9
@@ -3071,21 +3071,21 @@ sub process { · 3070 unmodified lines
3071# check SPDX comment style for .[chsS] files3071# check SPDX comment style for .[chsS] files
3072 if ($realfile =~ /\.[chsS]$/ &&3072 if ($realfile =~ /\.[chsS]$/ &&
3073 $rawline =~ /SPDX-License-Identifier:/ &&3073 $rawline =~ /SPDX-License-Identifier:/ &&
3074 $rawline !~ /^\+\s*\Q$comment\E\s*/) {3074 $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
3075 WARN("SPDX_LICENSE_TAG",3075 WARN("SPDX_LICENSE_TAG",
3076 "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);3076 "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
3077 }3077 }
3078 3078
3079 if ($comment !~ /^$/ &&3079 if ($comment !~ /^$/ &&
3080 $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {3080 $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
3081 WARN("SPDX_LICENSE_TAG",3081 WARN("SPDX_LICENSE_TAG",
3082 "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);3082 "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
3083 } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {3083 } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
3084 my $spdx_license = $1;3084 my $spdx_license = $1;
3085 if (!is_SPDX_License_valid($spdx_license)) {3085 if (!is_SPDX_License_valid($spdx_license)) {
3086 WARN("SPDX_LICENSE_TAG",3086 WARN("SPDX_LICENSE_TAG",
3087 "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);3087 "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
3088 }3088 }
3089 }3089 }
3090 }3090 }
3091 }3091 }