[PATCH] checkpatch: Look for Kconfig indentation errors
From: Krzysztof Kozlowski
Date: Wed Nov 27 2019 - 21:09:31 EST
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@xxxxxxxxxx>
---
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