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.
This commit is contained in:
Thomas Haller 2018-07-11 08:23:56 +02:00
parent e82e2ca730
commit 2d28d5d5d4

View file

@ -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/;