[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1b6f7d8b9cf4583ac399824977e081f720cdaf01.1388085015.git.joe@perches.com>
Date: Thu, 26 Dec 2013 11:20:30 -0800
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Josh Triplett <josh@...htriplett.org>,
Manfred Spraul <manfred@...orfullife.com>,
Andy Whitcroft <apw@...onical.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] checkpatch: Improve space before tab --fix option
This test should remove all the spaces before a tab not
just one space.
Substitute a tab for each 8 space block before a tab and
remove less than 8 spaces before a tab.
This SPACE_BEFORE_TAB test is done after CODE_INDENT.
If there are spaces used at the beginning of a line that
should be converted to tabs, please make sure that the
CODE_INDENT test and conversion is done before this
SPACE_BEFORE_TAB test and conversion.
Reported-by: Manfred Spraul <manfred@...orfullife.com>
Signed-off-by: Joe Perches <joe@...ches.com>
---
scripts/checkpatch.pl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 19376b4..db72b88 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2118,8 +2118,10 @@ sub process {
if (WARN("SPACE_BEFORE_TAB",
"please, no space before tabs\n" . $herevet) &&
$fix) {
- $fixed[$linenr - 1] =~
- s/(^\+.*) +\t/$1\t/;
+ while ($fixed[$linenr - 1] =~
+ s/(^\+.*) {8,8}+\t/$1\t\t/) {}
+ while ($fixed[$linenr - 1] =~
+ s/(^\+.*) +\t/$1\t/) {}
}
}
--
1.8.1.2.459.gbcd45b4.dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists