Skip to content

Add W504 for line breaks before binary operators#502

Merged
IanLee1521 merged 5 commits intoPyCQA:masterfrom
sigmavirus24:add-W504
Jan 19, 2018
Merged

Add W504 for line breaks before binary operators#502
IanLee1521 merged 5 commits intoPyCQA:masterfrom
sigmavirus24:add-W504

Conversation

@sigmavirus24
Copy link
Member

@sigmavirus24 sigmavirus24 commented Apr 30, 2016

This flips the W503 rule to enforce line breaks before binary operators.

Related #498


TODO:

  • Add W504 to list of codes
  • Add W504 to default ignore
  • Fix tests

@sigmavirus24
Copy link
Member Author

@IanLee1521 I know the tests are failing, and I'm going to have to figure out how to fix them, but I'd love some code review.


def break_around_binary_operator(logical_line, tokens):
def _is_binary_operator(token_type, text):
# The % character is strictly speaking a binary operator, but the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but I'd prefer to move this to a """...""" style doc string rather than # since we're touching it anyways.

@IanLee1521
Copy link
Member

@sigmavirus24 -- Made a few in line comments, nothing major, overall looks good to me 👍 if we fix the tests I have no issues merging.

@IanLee1521
Copy link
Member

@sigmavirus24 -- I've been working most of the day on fixing the tests and getting some other things merged. I captured the branch at: https://github.com/PyCQA/pycodestyle/tree/gh-502

I'm on the last failure (https://travis-ci.org/PyCQA/pycodestyle/builds/140304242) still chipping away if you have any thoughts...

@IanLee1521 IanLee1521 modified the milestones: 2.2, 2.1 Jun 26, 2016
@hoylemd
Copy link

hoylemd commented Jul 18, 2016

Are there any updates on this? My team would very much like to use it. If development has stalled, could we grab the branch and polish it off?

@sigmavirus24
Copy link
Member Author

@hoylemd, thanks for the interest! @IanLee1521 has updated this a bit on https://github.com/PyCQA/pycodestyle/tree/gh-502 but there are still failing tests. If you can fix those, you're welcome to take over this work and submit a new PR!

hackaugusto added a commit to hackaugusto/raiden that referenced this pull request Nov 2, 2016
- removed pep8 from the travis.yml until PyCQA/pycodestyle#502 is merged.
- fixed one additional style issue
hackaugusto added a commit to hackaugusto/raiden that referenced this pull request Nov 3, 2016
- removed pep8 from the travis.yml until PyCQA/pycodestyle#502 is merged.
- fixed one additional style issue
hackaugusto added a commit to hackaugusto/raiden that referenced this pull request Nov 3, 2016
- removed pep8 from the travis.yml until PyCQA/pycodestyle#502 is merged.
- fixed one additional style issue
schmir pushed a commit to raiden-network/raiden that referenced this pull request Nov 6, 2016
- removed pep8 from the travis.yml until PyCQA/pycodestyle#502 is merged.
- fixed one additional style issue
schmir pushed a commit to raiden-network/raiden that referenced this pull request Nov 6, 2016
- removed pep8 from the travis.yml until PyCQA/pycodestyle#502 is merged.
- fixed one additional style issue
FichteFoll added a commit to packagecontrol/st_package_reviewer that referenced this pull request Jun 1, 2017
Ideally I'd like to have a check for this, but pycodestyle doesn't have
one yet.

See also PyCQA/pycodestyle#502.
@peterjc
Copy link
Contributor

peterjc commented Jan 11, 2018

It looks like flake8 assumed this was going to be merged and already ignores it by default?
https://gitlab.com/pycqa/flake8/issues/397

@FichteFoll
Copy link
Contributor

The only thing holding this back are failing tests, right?

peterjc added a commit to peterjc/pycodestyle that referenced this pull request Jan 23, 2018
Cross reference changes in pull request PyCQA#502 which added this.
@peterjc
Copy link
Contributor

peterjc commented Jan 23, 2018

Pull request #724 submitted to update the list of error codes.

JureZmrzlikar pushed a commit to JureZmrzlikar/resolwe-bio-py that referenced this pull request Apr 13, 2018
Note that the new recommended way is to use line break before
binary operators. Follow the discussion here:
PyCQA/pycodestyle#502
opacam pushed a commit to opacam/Cohen3 that referenced this pull request Sep 5, 2018
Also fixes pep8 error: W605 (invalid escape sequence '\.') and disables pep8 error W504 from pycodestyle tests.

Solves: #10
References: PyCQA/pycodestyle#502
opacam pushed a commit to opacam/Cohen3 that referenced this pull request Sep 5, 2018
Also fixes pep8 error: W605 (invalid escape sequence '\.') and disables pep8 error W504 from pycodestyle tests.

Right now all the pycodestyle tests should be passed and only the pylint tests should cause the travis tests to fail.

Resolves: #10
References: PyCQA/pycodestyle#502
opacam added a commit to opacam/Cohen3 that referenced this pull request Sep 12, 2018
Also fixes pep8 error: W605 (invalid escape sequence '\.') and disables pep8 error W504 from pycodestyle tests.

Right now all the pycodestyle tests should be passed and only the pylint tests should cause the travis tests to fail.

Resolves: #10
References: PyCQA/pycodestyle#502
NikolausDemmel added a commit to NikolausDemmel/rosdep that referenced this pull request Oct 27, 2018
wjwwood pushed a commit to ros-infrastructure/rosdep that referenced this pull request Nov 1, 2018
…e W504 (#636)

* format_map is python 3.2 or later only (see also #602)

* Ignore new pycodestyle rule W504

Was introduced in PyCQA/pycodestyle#502 it seems.

Makes travis on master fail https://travis-ci.org/ros-infrastructure/rosdep/jobs/445522297
at-wat pushed a commit to at-wat/rosdep that referenced this pull request Nov 15, 2018
…e W504 (ros-infrastructure#636)

* format_map is python 3.2 or later only (see also ros-infrastructure#602)

* Ignore new pycodestyle rule W504

Was introduced in PyCQA/pycodestyle#502 it seems.

Makes travis on master fail https://travis-ci.org/ros-infrastructure/rosdep/jobs/445522297
damb pushed a commit to EIDA/mediatorws that referenced this pull request Nov 21, 2018
muffgaga pushed a commit to electronicvisions/code-format that referenced this pull request Jun 18, 2019
* W503 is in conflict with the more modern W504
  See PyCQA/pycodestyle#502

Change-Id: I1f29b362e0f0c6893a81c5cd12a862890e8d8609
mbakar01 added a commit to mbakar01/pycodestyle that referenced this pull request Mar 15, 2020
sipwise-jenkins pushed a commit to sipwise/system-tests that referenced this pull request Aug 2, 2021
We use quite old pep8 v1.6.2 which in particular misses this
change PyCQA/pycodestyle#502
Let's update Dockerfile to use pycodestyle(former pep8) from
bullseye.

Change-Id: Id29acd80be212cffa127550d9a4deb764a5b5b30
sipwise-jenkins pushed a commit to sipwise/system-tests that referenced this pull request Aug 11, 2021
We use quite old pep8 v1.6.2 which in particular misses this
change PyCQA/pycodestyle#502
Let's update Dockerfile to use pycodestyle(former pep8) from
bullseye.

Change-Id: Id29acd80be212cffa127550d9a4deb764a5b5b30
(cherry picked from commit d552f2c0c2bbb8c802aa29ac9c23ed4c12d5a1cc)
(cherry picked from commit ae28060)
sipwise-jenkins pushed a commit to sipwise/system-tests that referenced this pull request Aug 11, 2021
We use quite old pep8 v1.6.2 which in particular misses this
change PyCQA/pycodestyle#502
Let's update Dockerfile to use pycodestyle(former pep8) from
bullseye.

Change-Id: Id29acd80be212cffa127550d9a4deb764a5b5b30
(cherry picked from commit d552f2c0c2bbb8c802aa29ac9c23ed4c12d5a1cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants