Commit c76f4cb3 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

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: default avatarManfred Spraul <>
Signed-off-by: default avatarJoe Perches <>
Cc: Josh Triplett <>
Cc: Andy Whitcroft <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 9624b8d6
......@@ -2118,8 +2118,10 @@ sub process {
"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/) {}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment