2008-03-19 21:41:53

by Daolong Wang

[permalink] [raw]
Subject: [PATCH]CHECKPATCH:fix misleading output on spaces/tabs error

I got confused by this line:

"ERROR: use tabs not spaces"

It literally means "use tabs but not spaces is WRONG", which
is WRONG.

"ERROR: do not use spaces when tabs expected"

sounds more appropriate.

Signed-off-by: Wang Daolong <[email protected]>
---
--- scripts/checkpatch.pl.org 2008-03-18 23:08:41.000000000 +0800
+++ scripts/checkpatch.pl 2008-03-18 23:19:34.000000000 +0800
@@ -1064,7 +1064,7 @@ sub process {
if ($rawline =~ /^\+\s* \t\s*\S/ ||
$rawline =~ /^\+\s* \s*/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
- ERROR("use tabs not spaces\n" . $herevet);
+ ERROR("do not use spaces when tabs expected\n" . $herevet);
}

# check for RCS/CVS revision markers


2008-03-19 20:54:33

by Andy Whitcroft

[permalink] [raw]
Subject: Re: [PATCH]CHECKPATCH:fix misleading output on spaces/tabs error

On Wed, Mar 19, 2008 at 11:06:02AM +0800, Daolong Wang wrote:
> I got confused by this line:
>
> "ERROR: use tabs not spaces"
>
> It literally means "use tabs but not spaces is WRONG", which
> is WRONG.
>
> "ERROR: do not use spaces when tabs expected"
>
> sounds more appropriate.

Except that it says "use tabs not spaces when you should use tabs" and
doesn't actually tell us what the error was, nor how to correct it. So
its not really any better than the original (which is also useless in
this regard).

How about:

"code indent should use tabs where possible"

> Signed-off-by: Wang Daolong <[email protected]>
> ---
> --- scripts/checkpatch.pl.org 2008-03-18 23:08:41.000000000 +0800
> +++ scripts/checkpatch.pl 2008-03-18 23:19:34.000000000 +0800
> @@ -1064,7 +1064,7 @@ sub process {
> if ($rawline =~ /^\+\s* \t\s*\S/ ||
> $rawline =~ /^\+\s* \s*/) {
> my $herevet = "$here\n" . cat_vet($rawline) . "\n";
> - ERROR("use tabs not spaces\n" . $herevet);
> + ERROR("do not use spaces when tabs expected\n" . $herevet);
> }
>
> # check for RCS/CVS revision markers

-apw

2008-03-20 04:11:08

by Daolong Wang

[permalink] [raw]
Subject: Re: [PATCH]CHECKPATCH:fix misleading output on spaces/tabs error

>
> Except that it says "use tabs not spaces when you should use tabs" and
> doesn't actually tell us what the error was, nor how to correct it. So
> its not really any better than the original (which is also useless in
> this regard).
>
> How about:
>
> "code indent should use tabs where possible"
>
>
My point is the original isn't good.

And about the replacement, that was just my suggestion.
We can choose one that'll please everyone.
In fact, either mine or yours is much better.

Add cc, Sorry for repeating.