mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	"Enrico Weigelt, metux IT consult" <lkml@metux.net>
Subject: [PATCH] checkpatch: Add test for SPDX-License-Identifier on wrong line #
Date: Fri, 08 Feb 2019 12:44:37 -0800	[thread overview]
Message-ID: <9b74ee87f8c1b8fd310e213fcb4994d58610fcb6.camel@perches.com> (raw)
In-Reply-To: <dfd0101f4a596600e2f0f8cf36886cf01c7dcb67.camel@perches.com>

Warn when any SPDX-License-Identifier: tag is not created
on the proper line number.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 216480ae29d1..d0001fd1112d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3075,6 +3075,14 @@ sub process {
 # check we are in a valid source file if not then ignore this hunk
 		next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
 
+# check for using SPDX-License-Identifier on the wrong line number
+		if ($realline != $checklicenseline &&
+		    $rawline =~ /\bSPDX-License-Identifier:/ &&
+		    substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) {
+			WARN("SPDX_LICENSE_TAG",
+			     "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr);
+		}
+
 # line length limit (with some exclusions)
 #
 # There are a few types of lines that may extend beyond $max_line_length:


  reply	other threads:[~2019-02-08 20:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  1:16 [PATCH 1/2] x86: gpio: AMD G-Series pch gpio platform driver Enrico Weigelt, metux IT consult
2019-02-08  1:16 ` [PATCH 2/2] x86: pcengines apuv2 gpio/leds/keys " Enrico Weigelt, metux IT consult
2019-02-08 14:30   ` Linus Walleij
2019-02-08 15:21     ` Andy Shevchenko
2019-02-11 10:38     ` Enrico Weigelt, metux IT consult
2019-02-13  9:35       ` Linus Walleij
2019-02-14 10:57         ` Enrico Weigelt, metux IT consult
2019-02-08 14:25 ` [PATCH 1/2] x86: gpio: AMD G-Series pch gpio " Linus Walleij
2019-02-08 15:20   ` Andy Shevchenko
2019-02-08 17:47   ` Joe Perches
2019-02-08 20:44     ` Joe Perches [this message]
2019-02-11 12:41       ` [PATCH] checkpatch: Add test for SPDX-License-Identifier on wrong line # Enrico Weigelt, metux IT consult
2019-02-11 12:49         ` Joe Perches
2019-02-11 10:46   ` [PATCH 1/2] x86: gpio: AMD G-Series pch gpio platform driver Enrico Weigelt, metux IT consult
2019-02-13  9:02     ` Linus Walleij
2019-02-14  9:53       ` Enrico Weigelt, metux IT consult
2019-02-14  9:56   ` Enrico Weigelt, metux IT consult
2019-02-20  9:37     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b74ee87f8c1b8fd310e213fcb4994d58610fcb6.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@metux.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®