[patch] checkpatch: relax spacing and line length

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <apw@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel Mailing List <linux-kernel@...>
Date: Sunday, April 6, 2008 - 12:54 am

===
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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] checkpatch: relax spacing and line length, Jan Engelhardt, (Sun Apr 6, 12:54 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Tue Apr 8, 1:12 pm)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Wed Apr 9, 8:19 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 9:25 am)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Wed Apr 9, 1:02 pm)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Sun Apr 13, 5:53 am)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Tue Apr 15, 5:09 am)
Re: [patch] checkpatch: relax spacing and line length, Jan Engelhardt, (Fri Apr 11, 12:24 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 4:16 pm)
Re: [patch] checkpatch: relax spacing and line length, Stefan Richter, (Wed Apr 9, 1:27 pm)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Wed Apr 9, 8:10 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 4:19 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 4:30 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 9:14 am)
Re: [patch] checkpatch: relax spacing and line length, Randy Dunlap, (Wed Apr 9, 11:14 am)
Re: [patch] checkpatch: relax spacing and line length, Jan Engelhardt, (Wed Apr 9, 9:18 am)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 9:58 am)
Re: [patch] checkpatch: relax spacing and line length, Andrew Morton, (Wed Apr 9, 12:53 pm)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Wed Apr 9, 4:07 pm)
Re: [patch] checkpatch: relax spacing and line length, Andy Whitcroft, (Fri Apr 11, 11:54 am)
Re: [patch] checkpatch: relax spacing and line length, Sam Ravnborg, (Sun Apr 6, 7:08 am)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Mon Apr 7, 12:37 pm)
Re: [patch] checkpatch: relax spacing and line length, Andrew Morton, (Sun Apr 6, 1:18 am)
Re: [patch] checkpatch: relax spacing and line length, Benny Halevy, (Sun Apr 6, 7:52 am)
Re: [patch] checkpatch: relax spacing and line length, Boaz Harrosh, (Mon Apr 7, 5:51 am)