Re: [PATCH v2] checkpatch: report warning with files ending with blank lines

From: Christian Marangi

Date: Wed Oct 07 2026 - 12:52:54 EST


On Wed, Oct 07, 2026 at 09:49:48AM -0700, Joe Perches wrote:
> On Wed, 2026-10-07 at 14:28 +0200, Christian Marangi wrote:
> > ```
> > On applying patch, git, depending on the default configuration, might
> > complain for any file having blank lines at end of file.
>
> I was not clear enough in my first reply.
>
> I meant that the test should be done only once, not
> for each line of the input.
>
> After the end of the process() loop of
>
> foreach my $rawline (@rawlines) {
> [...]
> }
>
> a single test of $rawlines[-1] could be done.

Yes I also was with that idea but then I quickly figure it out that we are
not testing if the .patch have blank line at EOF. But if the single file of
the patch have blank line at EOF.

That can only be done in the process() while scanning each line as it does
progressively check new files in it.

(unless I'm missing something)

--
Ansuel