Re: [PATCH] Drop 80-character limit in checkpatch.pl

From: AmÃrico Wang
Date: Thu Dec 17 2009 - 04:32:01 EST


On Wed, Dec 16, 2009 at 6:26 AM, Bartlomiej Zolnierkiewicz
<bzolnier@xxxxxxxxx> wrote:
> On Tuesday 15 December 2009 10:57:49 pm Mikulas Patocka wrote:
>
>> But some maintainers take output of the script checkpatch.pl dogmatically,
>> requiring that every new work must pass the script without a warning. This is
>> counterproductive --- if I write a driver and I will be doing most maintenance
>> work on it in the future, it is viable that the driver is formatted in such
>> a way that is best editable for me, not for anyone else. And as shown in example
>> (1), this 80-column requirement makes even simple changes much harder.
>
> It has been agreed in the past that 80-column warnings shouldn't result
> automatically in the rejection of the new hardware support so the above
> argumentation is a bit weak.
>
>> So: I am submitting this patch for the checkpatch.pl script.
>>
>>
>> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
>
> Having this limitation makes people at least think about designing their
> code properly and making it more compact.
>
> If you don't want to see such warnings just apply the following patch that
> I've been keeping locally (it helped me to work on staging drivers):
>
> From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
> Subject: [PATCH] checkpatch.pl: add option to disable 80 column limit check
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>


I like this patch, this is actually what I wanted to do.

Acked-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>

Thanks!

> ---
> Âscripts/checkpatch.pl | Â Â5 ++++-
> Â1 file changed, 4 insertions(+), 1 deletion(-)
>
> Index: b/scripts/checkpatch.pl
> ===================================================================
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -17,6 +17,7 @@ use Getopt::Long qw(:config no_auto_abbr
> Âmy $quiet = 0;
> Âmy $tree = 1;
> Âmy $chk_signoff = 1;
> +my $chk_cl = 1;
> Âmy $chk_patch = 1;
> Âmy $tst_only;
> Âmy $emacs = 0;
> @@ -41,6 +42,7 @@ Options:
>  -q, --quiet        Âquiet
>  --no-tree         Ârun without a kernel tree
>  --no-signoff        do not check for 'Signed-off-by' line
> + Â--no-cl          Âdo not apply 80 column limit
>  --patch          Âtreat FILE as patchfile (default)
>  --emacs          Âemacs compile window format
>  --terse          Âone line per report
> @@ -67,6 +69,7 @@ GetOptions(
> Â Â Â Â'q|quiet+' Â Â Â=> \$quiet,
> Â Â Â Â'tree!' Â Â Â Â => \$tree,
> Â Â Â Â'signoff!' Â Â Â=> \$chk_signoff,
> + Â Â Â 'cl!' Â Â Â Â Â => \$chk_cl,
> Â Â Â Â'patch!' Â Â Â Â=> \$chk_patch,
> Â Â Â Â'emacs!' Â Â Â Â=> \$emacs,
> Â Â Â Â'terse!' Â Â Â Â=> \$terse,
> @@ -1365,7 +1368,7 @@ sub process {
> Â Â Â Â Â Â Â Ânext if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
>
> Â#80 column limit
> - Â Â Â Â Â Â Â if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
> + Â Â Â Â Â Â Â if ($chk_cl && $line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
> Â Â Â Â Â Â Â Â Â Â$rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
> Â Â Â Â Â Â Â Â Â Â$line !~ /^\+\s*printk\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ &&
> Â Â Â Â Â Â Â Â Â Â$length > 80)
> --
> 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/
>
--
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/