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

Add W504 for line breaks before binary operators #502

Merged
merged 5 commits into from
Jan 19, 2018

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.

pep8.py Outdated
@@ -1018,7 +1018,15 @@ def explicit_line_join(logical_line, tokens):
parens -= 1


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?

johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule
W504](PyCQA/pycodestyle#502) where previously
this code was styled to comply with [flake8 rule
W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html) which has
fallen out of favor. W503 is set to be ignored
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule
W504](PyCQA/pycodestyle#502) where previously
this code was styled to comply with [flake8 rule
W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html) which has
fallen out of favor. W503 is set to be ignored
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Oct 24, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
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
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Nov 13, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Nov 13, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
johnduarte pushed a commit to rcbops/molecule-rpc-openstack-post-deploy that referenced this pull request Nov 13, 2018
This commit updates to comply with the style of [flake8 rule W504](PyCQA/pycodestyle#502)
where previously this code was styled to comply with [flake8 rule W503](https://lintlyci.github.io/Flake8Rules/rules/W503.html)
which has fallen out of favor. W503 is set to be ignored

(cherry picked from commit 0fe98e1)
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