[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1513876977.4599.14.camel@perches.com>
Date: Thu, 21 Dec 2017 09:22:57 -0800
From: Joe Perches <joe@...ches.com>
To: Rob Herring <robh@...nel.org>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Andy Whitcroft <apw@...onical.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Philippe Ombredanne <pombredanne@...b.com>
Subject: Re: [PATCH v4] checkpatch.pl: Add SPDX license tag check
On Thu, 2017-12-21 at 11:04 -0600, Rob Herring wrote:
> Okay, here's what I've ended up with:
>
> if ($realline == $checklicenseline) {
> if ($realfile =~ /\.(?:sh|pl|py)/ && $rawline =~ /\[ \+]\s*\!\#/) {
> $checklicenseline = 2;
> } elsif ($rawline =~ /^\+/) {
> my $comment = "";
> if ($realfile =~ /\.(h|s|S)$/) {
> $comment = '/\*';
> } elsif ($realfile =~ /\.(c|dts|dtsi)$/) {
> $comment = '//';
> } elsif ($realfile =~ /\.(sh|pl|py)$/) {
> $comment = '#';
> } elsif ($realfile =~ /\.rst$/) {
> $comment = '\.\.';
> }
>
> if ($comment !~ /^$/ &&
> $rawline !~ m@^\+$comment SPDX-License-Identifier: @) {
> WARN("SPDX_LICENSE_TAG",
> "Missing or malformed SPDX-License-Identifier tag in 1st (or 2nd for scripts) line\n" .
> $herecurr);
> }
> }
> }
Seems sensible enough.
Maybe it's better to use \Q$comment\E and a consistent
style on comment and rawline
Any checkpatch patch for license style requirements should
not be applied until after Documentation/license-rules.rst
is in -next.
Powered by blists - more mailing lists