summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-07-11 08:23:56 +0200
committerThomas Haller <thaller@redhat.com>2018-07-11 12:02:06 +0200
commit2d28d5d5d46d9830bea58727c03681baeee7feb8 (patch)
tree8794756cd4ca2936326601725722a70a5a92cf4a
parente82e2ca73095ef514041cd47ef333b8412b29b2e (diff)
downloadNetworkManager-2d28d5d5d46d9830bea58727c03681baeee7feb8.tar.gz
checkpatch: warn about non-leading tabs
Tabs are not only wrong after a space, they are always wrong if they don't appear at the beginning of a line. That would happen usually, when trying to align multiple lines like enum { VALUE1 = 1; OTHER_VALUE = 2; }; When doing that, the alignment will only be correct, if the reader later uses the same tab-width. Note that in NetworkManager we recommend the tab-width to be 4 characters, but with our "smart tab" indentation style, it wouldn't actually matter and the reader is free to choose any other tab-width -- as long as we don't use non-leading tabs. Don't allow non-leading tabs.
-rwxr-xr-xcontrib/scripts/checkpatch.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl
index 55e08498ad..2556445ce3 100755
--- a/contrib/scripts/checkpatch.pl
+++ b/contrib/scripts/checkpatch.pl
@@ -117,7 +117,7 @@ if ($is_file and $filename ne $ARGV) {
next unless $filename =~ /\.[ch]$/;
-complain ('Tab following a space') if $line =~ / \t/;
+complain ('Tabs are only allowed at the beginning of a line') if $line =~ /[^\t]\t/;
complain ('Trailing whitespace') if $line =~ /[ \t]$/;
complain ('Don\'t use glib typedefs for char/short/int/long/float/double') if $line =~ /\bg(char|short|int|long|float|double)\b/;