summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-09-18 18:44:21 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-09-24 13:21:12 +0200
commit66ddc92135ca7f8979a78324ecf266565e3d123d (patch)
treef3b14b28d222591c1b5d7e14b5ab3ee05e47b7e5
parent511709c54df5ecdc96453cb8af9796a54d901aa8 (diff)
downloadNetworkManager-66ddc92135ca7f8979a78324ecf266565e3d123d.tar.gz
checkpatch: detect some whitespace errors
Vim's trademark.
-rwxr-xr-xcontrib/scripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl
index f06ac7fc05..6fcccd6528 100755
--- a/contrib/scripts/checkpatch.pl
+++ b/contrib/scripts/checkpatch.pl
@@ -58,10 +58,12 @@ our @functions_seen;
our $type;
our $filename;
our $line_no;
+our $indent;
sub new_hunk
{
$type = undef;
+ $indent = "";
}
sub new_file
@@ -139,6 +141,10 @@ s/\s*\/\/.*//;
/^\s* \* / and next;
new_hunk if $_ eq '';
+my ($this_indent) = /^(\s*)/;
+complain ('Bad indentation') if $this_indent =~ /^$indent\t+ +/;
+$indent = $this_indent;
+
if (/^typedef*/) {
# We expect the { on the same line as the typedef. Otherwise it
# looks too much like a function declaration