From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Eduardo Habkost" <ehabkost@redhat.com>
Subject: Re: [PATCH] tests: add a "check-flake8" test for validating python code style
Date: Thu, 30 Apr 2020 12:29:28 +0200 [thread overview]
Message-ID: <9f000680-d32a-5e43-d45b-58391063b7fc@redhat.com> (raw)
In-Reply-To: <20200429153621.1694266-1-berrange@redhat.com>
On 29/04/20 17:36, Daniel P. Berrangé wrote:
> The flake8 program is a standard tool used by Python projects for
> validating many commonly recommended style rules. It would be desirable
> for QEMU to come into alignment with normal Python coding style best
> practices.
>
> QEMU currently violates a huge number of the style rules, so we can't
> blindly turn it on. Instead this patch introduces use of flake8 with
> a huge ignore list to turn off everything that is currently violated.
>
> The following descriptions are mostly taken from:
>
> https://www.flake8rules.com/
I suggest instead using "black" and just reformat everything in a huge
patch; that's what we're using for Patchew.
It's not perfect, and especially one needs to get used to the double
quotes instead of single quotes for strings. However overall it is
pretty good, and I've never seen it do something clearly "wrong".
> On its own this patch doesn't really do much of use except try to stop the
> situation getting worse. To be valuable some motivated contributor(s)
> would need to go through fixing the code, and re-enabling each excluded
> warning category one at a time.
>
> I'm mostly proposing this patch as a starting point for discussion, to
> see if anyone is indeed motivated to take on the code cleanup challenge,
> and feed the fixes in through the various maintainers trees.
If we go with "black" I suggest just doing a big patch for everything,
since it's easy for maintainers to rebase by running black at each step.
Overall our usage of Python is small enough that it should not be a big
deal.
Paolo
next prev parent reply other threads:[~2020-04-30 10:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 15:36 [PATCH] tests: add a "check-flake8" test for validating python code style Daniel P. Berrangé
2020-04-29 19:21 ` John Snow
2020-04-30 5:23 ` Markus Armbruster
2020-04-30 8:55 ` Daniel P. Berrangé
2020-04-30 13:40 ` Markus Armbruster
2020-04-30 10:29 ` Paolo Bonzini [this message]
2020-04-30 10:39 ` Daniel P. Berrangé
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=9f000680-d32a-5e43-d45b-58391063b7fc@redhat.com \
--to=pbonzini@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
/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).