lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 02 Sep 2010 19:03:23 +0200
From:	Albert ARIBAUD <albert.aribaud@...e.fr>
To:	linux-kernel@...r.kernel.org
CC:	Andy Whitcroft <apw@...onical.com>
Subject: [PATCH] add an option to control maximum line length

Some projects or people use checkpatch.pl but want a maximum
line length different from 80: provide option --max-line-length
which expects an integer (defaults to 80) as the length limit.

Signed-off-by: Albert Aribaud <albert.aribaud@...e.fr>
---
  scripts/checkpatch.pl |   45 ++++++++++++++++++++++++---------------------
  1 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2039acd..4cd54ff 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -16,6 +16,7 @@ use Getopt::Long qw(:config no_auto_abbrev);
   my $quiet = 0;
  my $tree = 1;
+my $maxlinelength = 80;
  my $chk_signoff = 1;
  my $chk_patch = 1;
  my $tst_only;
@@ -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
+  --max-line-length=LEN      warn for lines longer than LEN 
characters(default 80)
    --patch                    treat FILE as patchfile (default)
    --emacs                    emacs compile window format
    --terse                    one line per report
@@ -64,24 +66,25 @@ EOM
  }
   GetOptions(
-	'q|quiet+'	=> \$quiet,
-	'tree!'		=> \$tree,
-	'signoff!'	=> \$chk_signoff,
-	'patch!'	=> \$chk_patch,
-	'emacs!'	=> \$emacs,
-	'terse!'	=> \$terse,
-	'f|file!'	=> \$file,
-	'subjective!'	=> \$check,
-	'strict!'	=> \$check,
-	'root=s'	=> \$root,
-	'summary!'	=> \$summary,
-	'mailback!'	=> \$mailback,
-	'summary-file!'	=> \$summary_file,
-
-	'debug=s'	=> \%debug,
-	'test-only=s'	=> \$tst_only,
-	'h|help'	=> \$help,
-	'version'	=> \$help
+	'q|quiet+'		=> \$quiet,
+	'tree!'			=> \$tree,
+	'max-line-length=i'	=> \$maxlinelength,
+	'signoff!'		=> \$chk_signoff,
+	'patch!'		=> \$chk_patch,
+	'emacs!'		=> \$emacs,
+	'terse!'		=> \$terse,
+	'f|file!'		=> \$file,
+	'subjective!'		=> \$check,
+	'strict!'		=> \$check,
+	'root=s'		=> \$root,
+	'summary!'		=> \$summary,
+	'mailback!'		=> \$mailback,
+	'summary-file!'		=> \$summary_file,
+
+	'debug=s'		=> \%debug,
+	'test-only=s'		=> \$tst_only,
+	'h|help'		=> \$help,
+	'version'		=> \$help
  ) or help(1);
   help(0) if ($help);
@@ -1409,14 +1412,14 @@ sub process {
  # check we are in a valid source file if not then ignore this hunk
  		next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
  -#80 column limit
+#80 (or maxlinelength) column limit
  		if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
  		    $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
  		    !($line =~ 
/^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ 
||
  		    $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
-		    $length > 80)
+		    $length > $maxlinelength)
  		{
-			WARN("line over 80 characters\n" . $herecurr);
+			WARN("line over $maxlinelength characters\n" . $herecurr);
  		}
   # check for spaces before a quoted newline
-- 
1.7.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ