* [PATCH] checkpatch: add a fixer for missing newline at eof
@ 2020-10-14 21:15 trix
2020-10-15 0:42 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2020-10-14 21:15 UTC (permalink / raw)
To: apw, joe; +Cc: linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
Remove the trailing error message from the fixed lines
Signed-off-by: Tom Rix <trix@redhat.com>
---
scripts/checkpatch.pl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fab38b493cef..7d3db096bc44 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] checkpatch: add a fixer for missing newline at eof
2020-10-14 21:15 [PATCH] checkpatch: add a fixer for missing newline at eof trix
@ 2020-10-15 0:42 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2020-10-15 0:42 UTC (permalink / raw)
To: trix, apw; +Cc: linux-kernel
On Wed, 2020-10-14 at 14:15 -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Remove the trailing error message from the fixed lines
Hi Tom.
> diff --git 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");
This is misindented, the 4 spaces before fix_delete_line
should be a tab, otherwise this looks fine, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-15 0:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 21:15 [PATCH] checkpatch: add a fixer for missing newline at eof trix
2020-10-15 0:42 ` Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.