[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 02/11] scripts: qapi: black format main.py
|
From: |
Daniel P . Berrangé |
|
Subject: |
Re: [PATCH v2 02/11] scripts: qapi: black format main.py |
|
Date: |
Thu, 19 Oct 2023 08:30:15 +0100 |
|
User-agent: |
Mutt/2.2.9 (2022-11-12) |
On Thu, Oct 19, 2023 at 07:42:38AM +0200, Markus Armbruster wrote:
> Victor Toso <victortoso@redhat.com> writes:
>
> > On Wed, Oct 18, 2023 at 01:00:07PM +0200, Markus Armbruster wrote:
> >> Victor Toso <victortoso@redhat.com> writes:
> >>
> >> > flake8 complained:
> >> > ./main.py:60:1: E302 expected 2 blank lines, found 1
> >> >
> >> > Which is simple enough. My vim has black [0] enabled by default, so it
> >> > did some extra formatting. I'm proposing to follow it.
> >> >
> >> > [0] https://black.readthedocs.io/en/stable/
> >> >
> >> > Signed-off-by: Victor Toso <victortoso@redhat.com>
> >> > ---
> >> > scripts/qapi/main.py | 76 ++++++++++++++++++++++++++++----------------
> >> > 1 file changed, 48 insertions(+), 28 deletions(-)
> >>
> >> Is this all black hates about scripts/qapi/?
> >
> > No, just scripts/qapi/main.py.
> >
> >> Did you configure it in any way, and if yes, how?
> >
> > Only to reduce line length to 79.
> >
> > I can do a separate series for this, if the idea is accepted.
>
> Let's build a rough idea of how much churn this would be.
>
> We have a bit over 5000 lines:
>
> $ wc -l scripts/qapi/*py
> 419 scripts/qapi/commands.py
> 251 scripts/qapi/common.py
> 50 scripts/qapi/error.py
> 251 scripts/qapi/events.py
> 679 scripts/qapi/expr.py
> 368 scripts/qapi/gen.py
> 390 scripts/qapi/introspect.py
> 103 scripts/qapi/main.py
> 777 scripts/qapi/parser.py
> 1233 scripts/qapi/schema.py
> 71 scripts/qapi/source.py
> 387 scripts/qapi/types.py
> 429 scripts/qapi/visit.py
> 5408 total
>
> Feed them to black:
>
> $ black -q -l 75 scripts/qapi
> $ git-diff --stat
> scripts/qapi/commands.py | 448 +++++++++++++++++-----------
> scripts/qapi/common.py | 240 ++++++++++-----
> scripts/qapi/error.py | 15 +-
> scripts/qapi/events.py | 274 +++++++++++-------
> scripts/qapi/expr.py | 409 ++++++++++++++++----------
> scripts/qapi/gen.py | 187 +++++++-----
> scripts/qapi/introspect.py | 323 +++++++++++++--------
> scripts/qapi/main.py | 80 +++--
> scripts/qapi/parser.py | 370 +++++++++++++----------
> scripts/qapi/schema.py | 709
> +++++++++++++++++++++++++++++----------------
> scripts/qapi/source.py | 17 +-
> scripts/qapi/types.py | 369 ++++++++++++++---------
> scripts/qapi/visit.py | 355 ++++++++++++++---------
> 13 files changed, 2383 insertions(+), 1413 deletions(-)
>
> *Ouch*
>
> Peeking at the result, I see string quote normalization. Try again with
> that switched off, and the line length relaxed:
>
> $ black -q -l 79 -S scripts/qapi
> $ git-diff --stat
> scripts/qapi/commands.py | 357 +++++++++++++++++++++------------
> scripts/qapi/common.py | 170 ++++++++++++----
> scripts/qapi/error.py | 11 +-
> scripts/qapi/events.py | 220 +++++++++++++-------
> scripts/qapi/expr.py | 261 +++++++++++++++---------
> scripts/qapi/gen.py | 114 ++++++-----
> scripts/qapi/introspect.py | 231 +++++++++++++--------
> scripts/qapi/main.py | 72 ++++---
> scripts/qapi/parser.py | 224 ++++++++++++---------
> scripts/qapi/schema.py | 488
> +++++++++++++++++++++++++++++++--------------
> scripts/qapi/source.py | 7 +-
> scripts/qapi/types.py | 303 ++++++++++++++++++----------
> scripts/qapi/visit.py | 287 ++++++++++++++++----------
> 13 files changed, 1802 insertions(+), 943 deletions(-)
>
> Still massive churn.
FWIW, the .git-blame-ignore-revs file can be populated with commit
hashes afterwards, to make 'git blame' ignore the reformatting
changes. Doesn't help with people cherry-picking fixes to old
branches though, which is the other main downside of such churn.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH v2 00/11] qapi-go: add generator for Golang interface, Victor Toso, 2023/10/16
- [PATCH v2 01/11] qapi: re-establish linting baseline, Victor Toso, 2023/10/16
- [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go, Victor Toso, 2023/10/16
- [PATCH v2 03/11] qapi: golang: Generate qapi's enum types in Go, Victor Toso, 2023/10/16
- [PATCH v2 05/11] qapi: golang: Generate qapi's struct types in Go, Victor Toso, 2023/10/16
- [PATCH v2 02/11] scripts: qapi: black format main.py, Victor Toso, 2023/10/16
[PATCH v2 08/11] qapi: golang: Generate qapi's event types in Go, Victor Toso, 2023/10/16
[PATCH v2 07/11] qapi: golang: Generate qapi's union types in Go, Victor Toso, 2023/10/16
[PATCH v2 09/11] qapi: golang: Generate qapi's command types in Go, Victor Toso, 2023/10/16
[PATCH v2 10/11] qapi: golang: Add CommandResult type to Go, Victor Toso, 2023/10/16
[PATCH v2 11/11] docs: add notes on Golang code generator, Victor Toso, 2023/10/16
[PATCH v2 06/11] qapi: golang: structs: Address 'null' members, Victor Toso, 2023/10/16
Re: [PATCH v2 00/11] qapi-go: add generator for Golang interface, Victor Toso, 2023/10/27