Re: [PATCH] checkpatch: Warn on code with 6+ tab indentation

From: Joe Perches
Date: Fri Feb 03 2012 - 22:22:11 EST


On Fri, 2012-02-03 at 19:09 -0800, Linus Torvalds wrote:
> On Fri, Feb 3, 2012 at 5:33 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > You liked the same premise, but a worse
> > implementation, a couple years ago.
> > https://lkml.org/lkml/2009/12/18/289
> I have grown to dislike debatable parts of checkpatch over the years,
> which probably colors my reaction to things like this.
> I'd prefer for checkpatch to check things that are fairly black-and-white.
> >> Why? Because mindless checks like this would just lead to people
> >> making things worse and intermixing spaces there instead.
> > Can't happen.
> > They'll get a different warning about mixing tabs
> > and spaces or starting a line with spaces only.
> Ok,. fair enough. That makes it more likely to work.
> That said, I did a grep for six tabs, and we do seem to have quite a
> bit of code like that. 67 _thousand_ lines just in C files, if I did
> my grep right

I think that's a bad test.
It finds a _lot_ of line continuations.

The right test is _only_ for 6 or more tabs
followed by (if|for|while|do|else|switch)

$ grep -rP --include=*.[ch] "^\t{6,}(if|for|while|do|else|switch)" * | \
wc -l
1509


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/