Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Switch to W504 from W503 (line break before a logical operator) #545

Closed
yelizariev opened this issue Apr 23, 2018 · 9 comments
Closed

Switch to W504 from W503 (line break before a logical operator) #545

yelizariev opened this issue Apr 23, 2018 · 9 comments

Comments

@yelizariev
Copy link
Member

yelizariev commented Apr 23, 2018

Could OCA use W504, i.e.

if (vals.get('model') == 'ir.ui.view'
        and not self.env.context.get('duplicate_view_for_website')):

instead of W503, i.e.

if (vals.get('model') == 'ir.ui.view' and
        not self.env.context.get('duplicate_view_for_website')):

See
PyCQA/pycodestyle#498
https://github.com/PyCQA/pycodestyle/pull/502/files

Feel free to add 👍 or 👎 to this post

@yelizariev yelizariev changed the title W503 vs W504: line break before or after logical operator Switch to W504 from W503 (line break before or after logical operator) Apr 23, 2018
@yelizariev yelizariev changed the title Switch to W504 from W503 (line break before or after logical operator) Switch to W504 from W503 (line break before a logical operator) Apr 23, 2018
@legalsylvain
Copy link

I personaly against such rule changes.

  • It is matter of tastes, and doesn't provides any improvment.
  • requires a lot of changes, travis will fail if we apply this change of rule.
  • maintainers have other things more important than cosmetics changes like this. (IMO)

To be clear, I'm not more in favor of W504 than W503 or whatever, I just think that changing that rule will provides problems, without any improvment.

Regards.

@yelizariev
Copy link
Member Author

yelizariev commented Apr 23, 2018

There is always a way to apply changes softly (deactivate W503 and make W504 beta).

It is matter of tastes, and doesn't provides any improvment.

It's actually allows read code easily. See

[1] https://mail.python.org/pipermail/python-ideas/2016-April/039774.html
[2] http://bugs.python.org/issue26763
[3] https://hg.python.org/peps/rev/3857909d7956

http://rhodesmill.org/brandon/slides/2012-11-pyconca/#laying-down-the-law

maintainers have other things more important than cosmetics changes like this. (IMO)

The contributors too. Why OCA force them to update they code to W503?

@StefanRijnhart
Copy link
Member

Agree with @legalsylvain to allow both styles.

@yelizariev
Copy link
Member Author

Allowing both is also a solution

@moylop260
Copy link
Contributor

Changing this style rule we will have too many travis red results.

If the current style was changed and the new one will make us headaches... then what about remove this rule?

Adding it to ignore section of the flake8 configuration file: W503

@yelizariev
Copy link
Member Author

Also, we can disable W503 and apply W504 since odoo 12

@moylop260
Copy link
Contributor

moylop260 commented Apr 23, 2018

Allowing both is also a solution

The technical solution is ignoring both from the configuration file of flake8.

FYI we have advanced script for pylint (to choose a special configuration file for each odoo version or PR or betas...) but for flake8 (this check is a flake8 one) we don't have this options...

and IMHO allowing both is the same that to disable both.

moylop260 added a commit to vauxoo-dev/maintainer-quality-tools that referenced this issue Apr 23, 2018
@moylop260
Copy link
Contributor

FYI I have taken the liberty to have created the following PR:

pedrobaeza pushed a commit that referenced this issue Apr 23, 2018
@pedrobaeza
Copy link
Member

Closed by allowing both in #546

luisg123v added a commit to vauxoo-dev/pylint-odoo that referenced this issue May 19, 2018
    This change allows both formatting styles when a line break is
    around a binary operator, to be before or after the operator. This
    is due to a change in PEP-8 recomendations.

    For more info, see the following MQT issue:
    OCA/maintainer-quality-tools#545
luisg123v added a commit to vauxoo-dev/pylint-odoo that referenced this issue May 19, 2018
This change allows both formatting styles when a line break is around a
binary operator, to be before or after the operator. This is due to a
change in PEP-8 recomendations.

For more info, see the following MQT issue:
OCA/maintainer-quality-tools#545
moylop260 pushed a commit to OCA/pylint-odoo that referenced this issue May 20, 2018
Allows both formatting styles when a line break is around a
binary operator, to be before or after the operator. This is due to a
change in PEP-8 recommendations.

For more info, see the following MQT issue:
OCA/maintainer-quality-tools#545
luisg123v added a commit to vauxoo-dev/pylint-odoo that referenced this issue May 22, 2018
Allows both formatting styles when a line break is around a
binary operator, to be before or after the operator. This is due to a
change in PEP-8 recommendations.

For more info, see the following MQT issue:
OCA/maintainer-quality-tools#545
luisg123v pushed a commit to vauxoo-dev/maintainer-quality-tools that referenced this issue May 28, 2018
moylop260 pushed a commit to Vauxoo/maintainer-quality-tools that referenced this issue May 28, 2018
moylop260 pushed a commit to Vauxoo/maintainer-quality-tools that referenced this issue Jul 10, 2018
NL66278 pushed a commit to Therp/maintainer-quality-tools that referenced this issue Nov 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants