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
30713071 # check SPDX comment style for .[chsS] files
30723072 if ($realfile =~ /\.[chsS]$/ &&
30733073 $rawline =~ /SPDX-License-Identifier:/ &&
3074− $rawline !~ /^\+\s*\Q$comment\E\s*/) {
3074+ $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
30753075 WARN("SPDX_LICENSE_TAG",
30763076 "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
30773077 }
30783078
30793079 if ($comment !~ /^$/ &&
3080− $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {
3081− WARN("SPDX_LICENSE_TAG",
3082− "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
3080+ $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
3081+ WARN("SPDX_LICENSE_TAG",
3082+ "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
30833083 } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
3084− my $spdx_license = $1;
3085− if (!is_SPDX_License_valid($spdx_license)) {
3086− WARN("SPDX_LICENSE_TAG",
3087− "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
3088− }
3084+ my $spdx_license = $1;
3085+ if (!is_SPDX_License_valid($spdx_license)) {
3086+ WARN("SPDX_LICENSE_TAG",
3087+ "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
3088+ }
30893089 }
30903090 }
30913091 }