On 8/6/26 07:28, Markus Armbruster wrote:
> Thomas Huth <[email protected]> writes:
>
>> On 31/07/2026 15.40, Denis V. Lunev wrote:
>>> Patches sometimes carry a hunk whose entire content is one or two
>>> added blank lines. It changes nothing, it makes the diff longer and
>>> it survives review because nobody looks twice at a blank line. The
>>> blank line itself is perfectly fine, the gratuitous hunk is not.
>> Well, I wouldn't say that the blank line itself is fine. It depends.
>> In source code, there normally should not be more than one empty line 
>> between code blocks, that's why I complained to the patch in your pull 
>> request.
> For what it's worth, Python style *demands* two blank lines in places.
> Here's what happens when I delete one of them:
>
>     $ pycodestyle scripts/qapi/parser.py 
>     scripts/qapi/parser.py:656:1: E302 expected 2 blank lines, found 1
>
> Why?  PEP 8 "Style Guide for Python Code" section "Blank Lines":
>
> --> Surround top-level function and class definitions with two blank
> --> lines.
>
>     Method definitions inside a class are surrounded by a single blank
>     line.
>
>     Extra blank lines may be used (sparingly) to separate groups of
>     related functions. Blank lines may be omitted between a bunch of
>     related one-liners (e.g. a set of dummy implementations).
>
>     Use blank lines in functions, sparingly, to indicate logical
>     sections.
>
>     Python accepts the control-L (i.e. ^L) form feed character as
>     whitespace; many tools treat these characters as page separators, so
>     you may use them to separate pages of related sections of your
>     file. Note, some editors and web-based code viewers may not
>     recognize control-L as a form feed and will show another glyph in
>     its place.
>
> We run pycodestyle via flake8 from python/tests/linters.py.  Still not
> part of "make check".
>
> [...]
>
That is actually the difference in between what is done in
the kernel and here.

There are 3 main notes:
* kernel check is not running always, it is hidden under
  --strict-only
* kernel check is not executed over Python
* kernel check catches consecutive blank lines

Here my check is different - I am trying to catch junk
hunk, which was missed with manual eye review - just
blank line. Such hunks at my opinion are absolutely
useless and that is worth to flag.

Thus kernel style check would be complementary to my
one and they are orthogonal.

I propose to stay with this version. Anyway, if you
prefer, I could port Linux one. We could try to make
voting :-)

Thank you in advance,
    Den 

Reply via email to