On Wed, Oct 18, 2023 at 01:00:07PM +0200, Markus Armbruster wrote:
> Victor Toso <victort...@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 <victort...@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 via email to