[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: |
Wed, 18 Oct 2023 12:13:01 +0100 |
User-agent: |
Mutt/2.2.9 (2022-11-12) |
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/?
>
> Did you configure it in any way, and if yes, how?
The point of the 'black' tool is that it be highly opinionated and
bring (force) all projects in the python code into following the
same style. As such it intentionally has near zero configuration
options.
You can control the line length it uses (88 by default) and something
related to string quoting style normalization, but that's basically it.
Generally though developers should just run 'black' and accept all the
changes it makes without questioning.
Personally I'd encourage the use of black for any project with python
code, precisely to remove any need to spend time debating code style.
If a project is also using flake8 there's a config needed for flake8
to stop it conflicting with black though
eg in $gitroot/.flake8 you'd need at least:
[flake8]
max-line-length = 88
extend-ignore = E203
If QEMU intends to adopt black, at the very least we need to have
it validated by CI and probably by 'make check' too, to avoid
regressions.
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