lkml.org 
[lkml]   [2017]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] checkpatch: suppress false long-line warining
Date
For DOS-formatted patches, extra ^M symbol at the end of line
increases overall line length by 1.

It triggers unneeded warning if line is exactly 80 chars length.
This patch fixes it.

Discovered in discussion to this patch:
https://lkml.org/lkml/2017/11/25/24

v2: simplify as suggested by Joe Perches.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
CC: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 040aa79e1d9d..e7b941b8e6d7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2732,6 +2732,13 @@ sub process {

#trailing whitespace
if ($line =~ /^\+.*\015/) {
+ # If DOS line detected, additional ^M symbol at the end
+ # of line increases line length, so remove that ^M and
+ # decrease $length to avoid false positives when
+ # checking length of the line.
+ $line =~ s/[\s\015]+$//;
+ $length--;
+
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
if (ERROR("DOS_LINE_ENDINGS",
"DOS line endings\n" . $herevet) &&
--
2.11.0
\
 
 \ /
  Last update: 2017-12-05 17:35    [W:0.121 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site