Re: [PATCH] checkpatch: report warning with files ending with blank lines
From: Joe Perches
Date: Tue Oct 06 2026 - 13:47:42 EST
On Tue, 2026-10-06 at 12:21 +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.
>
> These blank lines can go unnotice by the patch submitter as they are not
> reported by checkpatch.pl with the maintainer only noticing the error when
> the patch is applied. This result in the submitter getting confused asking
> further info to the maintainer making the review process longer.
>
> To address this, add a simple logic to catch this error and report as
> warning. Example:
>
> WARNING: blank line at end of file
> 102: FILE: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml:62:
> + };
> +
While this might be a good idea, the placement
of this test is probably not good at the start
of the process() block.
I'd place it so it's only checked once at the
end of the process() block after all the rest
of the lines are tested.
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +# Check for blank line at end of file
[]
etc...