lkml.org 
[lkml]   [2009]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] scripts/checkpatch.pl: Add warning about leading contination tests
From
On Sat, Dec 05, 2009 at 09:58:04AM -0800, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@perches.com>
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index bc4114f..c35933a 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2064,6 +2064,11 @@ sub process {
> CHK("multiple assignments should be avoided\n" . $herecurr);
> }
>
> +# Check use of leading logical continuation tests
> + if ($line =~ /^.\s*(\|\||&&)/) {
> + WARN("Continuation logic should be at end of previous line\n" . $herecurr);
> + }
> +
> ## # check for multiple declarations, allowing for a function declaration
> ## # continuation.
> ## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&

Where does this preference come from?

In

excessivelylongcondition
&& anotherreallylongcondition
&& yetanotherunbelievablylongcondition
&& yetanotherwellyougettheidea

I want to be able to keep the &&'s all justified.

Or look for well-typeset math or CS texts and try to find any that leave
operators dangling on the right.

I don't really care much about this particular point, but: the
checkpatch output is already getting too verbose to be useful, without
adding advice that's actually the opposite of what I'd normally want to
do....

--b.


\
 
 \ /
  Last update: 2009-12-07 23:07    [W:0.081 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site