[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201017142546.28988-1-trix@redhat.com>
Date: Sat, 17 Oct 2020 07:25:46 -0700
From: trix@...hat.com
To: apw@...onical.com, joe@...ches.com
Cc: linux-kernel@...r.kernel.org, Tom Rix <trix@...hat.com>
Subject: [PATCH v2] checkpatch: add a fixer for missing newline at eof
From: Tom Rix <trix@...hat.com>
Remove the trailing error message from the fixed lines
Signed-off-by: Tom Rix <trix@...hat.com>
---
v2: fix whitespace
---
scripts/checkpatch.pl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fab38b493cef..f9e78a5385ad 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3393,8 +3393,11 @@ sub process {
# check for adding lines without a newline.
if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
- WARN("MISSING_EOF_NEWLINE",
- "adding a line without newline at end of file\n" . $herecurr);
+ if (WARN("MISSING_EOF_NEWLINE",
+ "adding a line without newline at end of file\n" . $herecurr) &&
+ $fix) {
+ fix_delete_line($fixlinenr+1, "No newline at end of file");
+ }
}
# check we are in a valid source file C or perl if not then ignore this hunk
--
2.18.1
Powered by blists - more mailing lists