qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 12/21] qapi.py: fix line break before binary


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v7 12/21] qapi.py: fix line break before binary operator pep8
Date: Tue, 10 Jan 2017 17:04:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Marc-André Lureau <address@hidden> writes:

> Hi
>
> ----- Original Message -----
>> Marc-André Lureau <address@hidden> writes:
>> 
>> > Python code style accepts both form, but pep8 complains. Better to clean
>> > up the single warning for now, so new errors stand out more easily.
>> >
>> > Fix scripts/qapi.py:1539:21: W503 line break before binary operator
>> 
>> PEP 8 permits both, but prefers line break before binary operator.
>> Thus, this warning is clearly bogus.  What version of pep8 do you use?
>> Mine doesn't warn.
>
> I tried both 1.6.2 and 1.7.0

I tried again, and I can now see the warning.  No idea what I did wrong
the first time.

Turns out PEP8 used to demand line break after the operator, but no
more[1].  The pep8 program hasn't caught up, but it will[2]: its current
git HEAD already suppresses W503.  There's work in progress[3] on a new
W504 to warn on line break after binary operator.

We will have to live with a mix of old and new pep8 / pycodestyle
versions.  Changing code to make new versions instead of old versions
complain instead is not a good idea.  We should simply ignore the
obsolete warning from old versions.

pep8 lets you do that with --ignore=W503.  Sadly, --ignore overwrites
the default, so you have to --ignore=E121,E123,E126,E226,E24,E704,W503.
Or have a file tox.ini with

    [pep8]
    ignore=E121,E123,E126,E226,E24,E704,W503


[1] https://hg.python.org/peps/rev/3857909d7956
[2] https://github.com/PyCQA/pycodestyle/issues/498
[3] https://github.com/PyCQA/pycodestyle/pull/502



reply via email to

[Prev in Thread] Current Thread [Next in Thread]