diff options
author | Joe Perches <joe@perches.com> | 2014-01-23 18:54:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:58 -0500 |
commit | c76f4cb3d25e5dc84017d7e845072e9aef6037f4 (patch) | |
tree | 68e8dc16563af714984bb236d904d1f4ca735f95 /scripts/checkpatch.pl | |
parent | 9624b8d65cd1e9a6415a81a6588e423b1d8c2282 (diff) |
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>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 93f8507b7ac2..3e0b3f4d3420 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2118,8 +2118,10 @@ sub process { | |||
2118 | if (WARN("SPACE_BEFORE_TAB", | 2118 | if (WARN("SPACE_BEFORE_TAB", |
2119 | "please, no space before tabs\n" . $herevet) && | 2119 | "please, no space before tabs\n" . $herevet) && |
2120 | $fix) { | 2120 | $fix) { |
2121 | $fixed[$linenr - 1] =~ | 2121 | while ($fixed[$linenr - 1] =~ |
2122 | s/(^\+.*) +\t/$1\t/; | 2122 | s/(^\+.*) {8,8}+\t/$1\t\t/) {} |
2123 | while ($fixed[$linenr - 1] =~ | ||
2124 | s/(^\+.*) +\t/$1\t/) {} | ||
2123 | } | 2125 | } |
2124 | } | 2126 | } |
2125 | 2127 | ||