mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
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@colorfullife.com> Signed-off-by: Joe Perches <joe@perches.com> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9624b8d65c
commit
c76f4cb3d2
@ -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/) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user