Skip to contentSkip to conversation

checkpatch: suppress false long-line warining

PATCH New Yury Norov 1 participant 1 message Dec 5, 2017 Checkpatch

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

PATCH v2 1/1 checkpatch: suppress false long-line warining

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.

---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/checkpatch.pl +7 -0
index 040aa79e1d9d..e7b941b8e6d7 100755
@@ -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) &&
Signature · 1 line
2.11.0