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

Eric W. Biederman
2012-02-04T02:37:43Z

Joe Perches <joe@perches.com> writes:

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2b52aeb..89d24b3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1924,6 +1924,12 @@ sub process {
> my $pre_ctx = "$1$2";
>
> my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
> +
> + if ($line =~ /^\+\t{6,}/) {
> + WARN("DEEP_INDENTATION",
> + "Too many leading tabs - consider code refactoring\n" . $herecurr);
> + }

By any chance have you run this patch against itself? I find it comical
that there is a line 104 characters long suggesting people use shorter
lines.

> my $ctx_cnt = $realcnt - $#ctx - 1;
> my $ctx = join("\n", @ctx);
>

Eric