linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Look for Kconfig indentation errors
@ 2019-11-28  2:06 Krzysztof Kozlowski
  2019-11-28  9:29 ` Jani Nikula
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2019-11-28  2:06 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, linux-kernel
  Cc: Jani Nikula, Pierre-Louis Bossart, Krzysztof Kozlowski

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-03  9:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28  2:06 [PATCH] checkpatch: Look for Kconfig indentation errors Krzysztof Kozlowski
2019-11-28  9:29 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).