Re: [Ksummit-discuss] checkkpatch (in)sanity ?

From: Joe Perches
Date: Mon Aug 29 2016 - 14:47:08 EST


On Mon, 2016-08-29 at 11:01 -0700, Joe Perches wrote:
> On Mon, 2016-08-29 at 17:46 +0000, Luck, Tony wrote:
> > [checkpatch] offered the advice
> > to restructure the code with helper functions etc. to avoid deep
> > indentation?
> It suggests that already for 6+ leading tabs,

And here's an inexact little histogram of the code that
expands indent levels in the -next kernel source tree.

$ grep -rP --include=*.[ch] -oh "^[\t]+(do|while|for|if|else|return|goto|continue|switch|default|case|break)\b" * | \
  sed -r 's/^(\t+).*$/\1/' | awk '{print length($0)}' | sort -n | uniq -c
1217165 1
 783085 2
 249655 3
  59775 4
  11653 5
   1993 6
    444 7
    158 8
     50 9
     19 10
     10 11
      4 12
      1 13

Some of that code, as Linus once put it, is eye-gouging.
Luckily, almost all of the 7+ tab indent code is prehistoric.