Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W504: yapf inserts line break after rather than before a binary operator #658

Closed
malcolmr opened this issue Dec 29, 2018 · 1 comment
Closed

Comments

@malcolmr
Copy link
Member

I see plenty of issues pointing out that yapf will line-break before binary operators (counter to the formatting originally required by pep8, triggering the off-by-default W503 warning), but I'm seeing the opposite in at least some cases, where the new recommendation isn't being followed, and yapf is still breaking after the operator.

With yapf 0.25.0:

$ cat > /tmp/x.py
def _():
    raise ValueError('This is a long message that ends with an argument: ' + str(42))
$ python -m yapf /tmp/x.py
def _():
    raise ValueError('This is a long message that ends with an argument: ' +
                     str(42))
$

This results in:

$ .python -m pycodestyle --ignore=W503 /tmp/x.py 
/tmp/x.py:2:22: W504 line break after binary operator
@themr0c
Copy link

themr0c commented Jan 29, 2019

same with flake8==3.6.0

gundalow pushed a commit to ansible/molecule that referenced this issue Jan 30, 2019
* 1694 lint errors

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* fixes #1694, reimplement #1574 - fix linting issues, upgrade flake8 to 3.6.0, make sure the versions of the packages are defined only in one single place.

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* fix #1694 lint errors - excluding rule [W504] line break after binary operator, as latest version of yapf is in conflict with this rule, see google/yapf#658.

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* fix #1694 lint errors - travis is using 'lint', not 'py{27,36,37}-lint', so cleanup the tox.ini

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* remove file commited by error

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* Update tox.ini

Co-Authored-By: themr0c <themr0c@users.noreply.github.com>

* reuse deps and extras

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>
ssbarnea pushed a commit to ssbarnea/molecule that referenced this issue Jan 31, 2019
* 1694 lint errors

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* fixes ansible#1694, reimplement ansible#1574 - fix linting issues, upgrade flake8 to 3.6.0, make sure the versions of the packages are defined only in one single place.

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* fix ansible#1694 lint errors - excluding rule [W504] line break after binary operator, as latest version of yapf is in conflict with this rule, see google/yapf#658.

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* fix ansible#1694 lint errors - travis is using 'lint', not 'py{27,36,37}-lint', so cleanup the tox.ini

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* remove file commited by error

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>

* Update tox.ini

Co-Authored-By: themr0c <themr0c@users.noreply.github.com>

* reuse deps and extras

Signed-off-by: Fabrice Flore-Thebault <themr0c@users.noreply.github.com>
bwendling added a commit that referenced this issue Feb 10, 2019
bwendling added a commit that referenced this issue Feb 10, 2019
bwendling added a commit that referenced this issue Feb 10, 2019
bwendling added a commit that referenced this issue Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants