linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] checkpatch: relax spacing and line length
@ 2008-04-06  4:54 Jan Engelhardt
  2008-04-06  5:18 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Jan Engelhardt @ 2008-04-06  4:54 UTC (permalink / raw)
  To: apw; +Cc: Andrew Morton, Linux Kernel Mailing List

===
total: 0 errors, 0 warnings, 36 lines checked

d27a9f5.diff has no obvious style problems and is ready for submission.
===
commit d27a9f5760fa231ab888f96e27355a001c88b239
Author: Jan Engelhardt <jengelh@computergmbh.de>
Date:   Sun Apr 6 06:49:01 2008 +0200

     checkpatch: relax spacing and line length

     We all had the arguments about 80 columns, so here goes a relax.
     Checking for 95 (or perhaps something better?), but of course we
     print "80" in the output, because if you happened to get to 95, it's
     "really time" to break it.

     This also relaxes the tab doctrine, because spaces DO make sense --
     especially when you view the code with a tab setting of not-8.

     Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
---
  scripts/checkpatch.pl |   22 ++++++++++++++++------
  1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 58a9494..e5a96c1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1094,8 +1094,8 @@ sub process {
  			my $herevet = "$here\n" . cat_vet($rawline) . "\n";
  			ERROR("trailing whitespace\n" . $herevet);
  		}
-#80 column limit
-		if ($line =~ /^\+/ && !($prevrawline=~/\/\*\*/) && $length > 80) {
+#80 column limit (yes, testing for 95 is correct, we do not want to annoy)
+		if ($line =~ /^\+/ && !($prevrawline=~/\/\*\*/) && $length >= 95) {
  			WARN("line over 80 characters\n" . $herecurr);
  		}

@@ -1107,12 +1107,22 @@ sub process {
  # check we are in a valid source file *.[hc] if not then ignore this hunk
  		next if ($realfile !~ /\.[hc]$/);

+		my $arg = qr/$Type(?: ?$Ident)?/;
+		if ($rawline =~ /^\+ +($arg, )*$arg(?:,|\);?)$/) {
+			# We are probably in a function parameter list.
+			# Spaces ok -- used for align.
+		} elsif ($rawline =~ /^\+\t+ *\S/) {
+			# We are probably in a function or an array/struct
+			# definition/initializer. Spaces ok -- used for align
+			# on multiline statements.
+		} else {
  # at the beginning of a line any tabs must come first and anything
  # more than 8 must use tabs.
-		if ($rawline =~ /^\+\s* \t\s*\S/ ||
-		    $rawline =~ /^\+\s*        \s*/) {
-			my $herevet = "$here\n" . cat_vet($rawline) . "\n";
-			ERROR("use tabs not spaces\n" . $herevet);
+			if ($rawline =~ /^\+\s* \t\s*\S/ ||
+			    $rawline =~ /^\+\s*        \s*/) {
+				my $herevet = "$here\n" . cat_vet($rawline) . "\n";
+				ERROR("use tabs not spaces\n" . $herevet);
+			}
  		}

  # check for RCS/CVS revision markers


^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2008-04-15  9:10 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-06  4:54 [patch] checkpatch: relax spacing and line length Jan Engelhardt
2008-04-06  5:18 ` Andrew Morton
2008-04-06 11:52   ` Benny Halevy
2008-04-06 18:52     ` Joe Perches
2008-04-07  9:51       ` Boaz Harrosh
2008-04-06 10:08 ` Adrian Bunk
2008-04-06 11:08   ` Sam Ravnborg
2008-04-07 16:37     ` Benny Halevy
2008-04-08 17:12 ` Andy Whitcroft
2008-04-08 18:01   ` Andi Kleen
2008-04-09  8:19     ` Andy Whitcroft
2008-04-09  8:30       ` Andy Whitcroft
2008-04-09  8:46         ` Andi Kleen
2008-04-09 13:14           ` Andy Whitcroft
2008-04-09 13:18             ` Jan Engelhardt
2008-04-09 13:58               ` Andy Whitcroft
2008-04-09 16:53                 ` Andrew Morton
2008-04-09 17:43                   ` Andi Kleen
2008-04-09 20:07                   ` Andy Whitcroft
2008-04-11 15:54                     ` Andy Whitcroft
2008-04-09 15:14             ` Randy Dunlap
2008-04-09 12:10   ` Benny Halevy
2008-04-09 12:19   ` Benny Halevy
2008-04-09 13:25     ` Andy Whitcroft
2008-04-09 17:02       ` Benny Halevy
2008-04-09 17:27         ` Stefan Richter
2008-04-09 20:16         ` Andy Whitcroft
2008-04-10 23:52         ` SL Baur
2008-04-11  4:24           ` Jan Engelhardt
2008-04-12  0:26         ` Al Viro
2008-04-13  9:53           ` Benny Halevy
2008-04-13 15:18             ` Al Viro
2008-04-15  9:09               ` Benny Halevy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).