qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Victor Toso <victortoso@redhat.com>,
	qemu-devel@nongnu.org, John Snow <jsnow@redhat.com>,
	Andrea Bolognani <abologna@redhat.com>
Subject: Re: [PATCH v2 02/11] scripts: qapi: black format main.py
Date: Wed, 18 Oct 2023 12:13:01 +0100	[thread overview]
Message-ID: <ZS+9vVemiYMYStvH@redhat.com> (raw)
In-Reply-To: <87pm1crya0.fsf@pond.sub.org>

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 :|



  reply	other threads:[~2023-10-18 11:13 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 15:26 [PATCH v2 00/11] qapi-go: add generator for Golang interface Victor Toso
2023-10-16 15:26 ` [PATCH v2 01/11] qapi: re-establish linting baseline Victor Toso
2023-10-16 15:26 ` [PATCH v2 02/11] scripts: qapi: black format main.py Victor Toso
2023-10-18 11:00   ` Markus Armbruster
2023-10-18 11:13     ` Daniel P. Berrangé [this message]
2023-10-18 15:23     ` Victor Toso
2023-10-19  5:42       ` Markus Armbruster
2023-10-19  7:30         ` Daniel P. Berrangé
2023-10-16 15:26 ` [PATCH v2 03/11] qapi: golang: Generate qapi's enum types in Go Victor Toso
2023-10-16 15:26 ` [PATCH v2 04/11] qapi: golang: Generate qapi's alternate " Victor Toso
2023-11-06 15:28   ` Andrea Bolognani
2023-11-06 15:52     ` Victor Toso
2023-11-06 16:12       ` Andrea Bolognani
2023-11-09 17:34   ` Andrea Bolognani
2023-11-09 19:01     ` Victor Toso
2023-11-10  9:58       ` Andrea Bolognani
2023-11-10 15:43         ` Victor Toso
2023-10-16 15:26 ` [PATCH v2 05/11] qapi: golang: Generate qapi's struct " Victor Toso
2023-10-16 15:26 ` [PATCH v2 06/11] qapi: golang: structs: Address 'null' members Victor Toso
2023-10-16 15:27 ` [PATCH v2 07/11] qapi: golang: Generate qapi's union types in Go Victor Toso
2023-11-09 17:29   ` Andrea Bolognani
2023-11-09 18:35     ` Victor Toso
2023-11-10  9:54       ` Andrea Bolognani
2023-11-10 15:45         ` Victor Toso
2023-10-16 15:27 ` [PATCH v2 08/11] qapi: golang: Generate qapi's event " Victor Toso
2023-11-09 17:59   ` Andrea Bolognani
2023-11-09 19:13     ` Victor Toso
2023-11-10  9:52       ` Andrea Bolognani
2023-10-16 15:27 ` [PATCH v2 09/11] qapi: golang: Generate qapi's command " Victor Toso
2023-10-16 15:27 ` [PATCH v2 10/11] qapi: golang: Add CommandResult type to Go Victor Toso
2023-11-09 18:24   ` Andrea Bolognani
2023-11-09 19:31     ` Victor Toso
2023-11-10  9:46       ` Andrea Bolognani
2023-10-16 15:27 ` [PATCH v2 11/11] docs: add notes on Golang code generator Victor Toso
2023-10-18 11:47   ` Markus Armbruster
2023-10-18 16:21     ` Victor Toso
2023-10-19  6:56       ` Markus Armbruster
2023-10-27 17:33 ` [PATCH v2 00/11] qapi-go: add generator for Golang interface Victor Toso
2023-10-31 16:42   ` Andrea Bolognani
2023-11-03 18:34     ` Andrea Bolognani
2023-11-06 12:00       ` Victor Toso
2023-11-09 18:35 ` Andrea Bolognani
2023-11-09 19:03   ` Victor Toso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZS+9vVemiYMYStvH@redhat.com \
    --to=berrange@redhat.com \
    --cc=abologna@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=victortoso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).