public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	linux-kernel@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCH] checkpatch: Look for Kconfig indentation errors
Date: Thu, 28 Nov 2019 03:06:40 +0100	[thread overview]
Message-ID: <1574906800-19901-1-git-send-email-krzk@kernel.org> (raw)

Kconfig should be indented with one tab for first level and tab+2 spaces
for second level.  There are many mixups of this so add a checkpatch
rule.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e41f4adcc1be..875e862cf076 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3046,6 +3046,13 @@ sub process {
 			     "Use of boolean is deprecated, please use bool instead.\n" . $herecurr);
 		}
 
+# Kconfig has special indentation
+		if ($realfile =~ /Kconfig/ &&
+		    ($rawline =~ /^\+ +\t* *[a-zA-Z-]/) || ($rawline =~ /^\+\t( |   )[a-zA-Z-]/)) {
+			WARN("CONFIG_INDENTATION",
+			     "Kconfig uses one tab indentation, optionally followed by two spaces.\n" . $herecurr);
+		}
+
 		if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
 		    ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
 			my $flag = $1;
-- 
2.7.4


             reply	other threads:[~2019-11-28  2:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28  2:06 Krzysztof Kozlowski [this message]
2019-11-28  9:29 ` [PATCH] checkpatch: Look for Kconfig indentation errors Jani Nikula
2019-11-28  9:34   ` Joe Perches
2019-12-03  8:40     ` Krzysztof Kozlowski
2019-12-03  8:55       ` Krzysztof Kozlowski
2019-12-03  8:56       ` Joe Perches
2019-12-03  9:23         ` Jani Nikula
2019-12-03  9:38           ` Joe Perches

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=1574906800-19901-1-git-send-email-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=apw@canonical.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    /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