* [PATCH] checkpatch.pl skip long lines
@ 2010-06-12 17:09 Fredrik Gustafsson
2010-06-13 1:04 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: Fredrik Gustafsson @ 2010-06-12 17:09 UTC (permalink / raw)
To: apw; +Cc: linux-kernel
Hi,
since the number of long lines in the linux kernel is huge and since
Greg Kroah Hartman in his google tech talk about the kernel
(http://www.youtube.com/watch?v=L2SED6sewRw) talked about probably
ignore that criteria in the future, I thought the checkpatch.pl script
should have an option to ignore checking for long lines.
This would help finding the real errors and warnings, because they don't
drown in line length warnings.
--
Regards
iveqy
>From ce6f2138969a56f5cbde2948f239c5204f0cafe1 Mon Sep 17 00:00:00 2001
From: iveqy <iveqy@iveqy.com>
Date: Sat, 12 Jun 2010 18:57:51 +0200
Subject: [PATCH] Add skiplinelength parameter
---
scripts/checkpatch.pl | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bd88f11..e0683f4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -29,6 +29,7 @@ my $summary_file = 0;
my $root;
my %debug;
my $help = 0;
+my $skip_line_length = 0;
sub help {
my ($exitcode) = @_;
@@ -49,6 +50,7 @@ Options:
--root=PATH PATH to the kernel tree root
--no-summary suppress the per-file summary
--mailback only produce a report in case of warnings/errors
+ --skiplinelength skip check for long lines
--summary-file include the filename in summary
--debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of
'values', 'possible', 'type', and 'attr' (default
@@ -81,6 +83,7 @@ GetOptions(
'debug=s' => \%debug,
'test-only=s' => \$tst_only,
'h|help' => \$help,
+ 'skiplinelength!' => \$skip_line_length,
'version' => \$help
) or help(1);
@@ -1401,12 +1404,13 @@ sub process {
next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
#80 column limit
- if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
- $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
- $line !~ /^\+\s*$logFunctions\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ &&
- $length > 80)
- {
- WARN("line over 80 characters\n" . $herecurr);
+ if(!$skip_line_length) {
+ if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
+ $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
+ $line !~ /^\+\s*$logFunctions\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ &&
+ $length > 80) {
+ WARN("line over 80 characters\n" . $herecurr);
+ }
}
# check for spaces before a quoted newline
--
1.6.4.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch.pl skip long lines
2010-06-12 17:09 [PATCH] checkpatch.pl skip long lines Fredrik Gustafsson
@ 2010-06-13 1:04 ` Wolfram Sang
2010-06-13 5:36 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2010-06-13 1:04 UTC (permalink / raw)
To: Fredrik Gustafsson; +Cc: apw, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 923 bytes --]
On Sat, Jun 12, 2010 at 07:09:44PM +0200, Fredrik Gustafsson wrote:
> since the number of long lines in the linux kernel is huge and since
> Greg Kroah Hartman in his google tech talk about the kernel
> (http://www.youtube.com/watch?v=L2SED6sewRw) talked about probably
> ignore that criteria in the future, I thought the checkpatch.pl script
> should have an option to ignore checking for long lines.
>
> This would help finding the real errors and warnings, because they don't
> drown in line length warnings.
Instead of adding another command-line option, I'd suggest to just use CHK
instead of WARN, so this check will be enabled with --strict. I wonder if there
is already consensus on deprecating the 80-char-rule?
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch.pl skip long lines
2010-06-13 1:04 ` Wolfram Sang
@ 2010-06-13 5:36 ` Joe Perches
2010-06-13 5:49 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2010-06-13 5:36 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Fredrik Gustafsson, apw, linux-kernel
On Sun, 2010-06-13 at 03:04 +0200, Wolfram Sang wrote:
> On Sat, Jun 12, 2010 at 07:09:44PM +0200, Fredrik Gustafsson wrote:
>
> > since the number of long lines in the linux kernel is huge and since
> > Greg Kroah Hartman in his google tech talk about the kernel
> > (http://www.youtube.com/watch?v=L2SED6sewRw) talked about probably
> > ignore that criteria in the future, I thought the checkpatch.pl script
> > should have an option to ignore checking for long lines.
> >
> > This would help finding the real errors and warnings, because they don't
> > drown in line length warnings.
>
> Instead of adding another command-line option, I'd suggest to just use CHK
> instead of WARN, so this check will be enabled with --strict. I wonder if there
> is already consensus on deprecating the 80-char-rule?
Nope. There's a vocal contingent that doesn't like it though.
An earlier thread and suggested patch below.
http://lkml.org/lkml/2009/12/18/3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch.pl skip long lines
2010-06-13 5:36 ` Joe Perches
@ 2010-06-13 5:49 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2010-06-13 5:49 UTC (permalink / raw)
To: Joe Perches; +Cc: Fredrik Gustafsson, apw, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 673 bytes --]
> > Instead of adding another command-line option, I'd suggest to just use CHK
> > instead of WARN, so this check will be enabled with --strict. I wonder if there
> > is already consensus on deprecating the 80-char-rule?
>
> Nope. There's a vocal contingent that doesn't like it though.
> An earlier thread and suggested patch below.
> http://lkml.org/lkml/2009/12/18/3
Thought so. I like your approach, missed it back then. I'd vote for 132 chars
as the next limit, though.
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-13 5:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-12 17:09 [PATCH] checkpatch.pl skip long lines Fredrik Gustafsson
2010-06-13 1:04 ` Wolfram Sang
2010-06-13 5:36 ` Joe Perches
2010-06-13 5:49 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox