mila-iqia / cookiecutter-pyml

MIT License
19 stars 7 forks source link

Flake8 W503 and W504 #10

Closed carriepl closed 3 years ago

carriepl commented 4 years ago

The current config makes flake8 enforce both W503 and W504 warnings which is contradictory.

W503 is "line break before binary operator" which prohibits the following :

x = ((some computation)
     + (some other computation))

W504 is "line break before binary operator" which prohibits the following :

x = ((some computation) +
     (some other computation))

Having both warnings on mean that we simply can have a line break in the vicinity of a binary operator.

According to the pep8 style guide (https://www.python.org/dev/peps/pep-0008/#id20) the recommendation used to be to have linebreaks after the binary operator but is now to have them before (since 2016 according to a discussion I saw on StackOverflow). Both styles are considered permissible so long as the code is locally consistent.

I think that at least one of those warning should be disabled. However, since both styles are permissible, disabling both would also be an option.

mirkobronzi commented 4 years ago

interesting - flake8 says that the tool should be updated to not enforce W503 (https://www.flake8rules.com/rules/W503.html), but it's still there.. Probably both the option of disabling W503 - or W503 and W04 are viable.

I f we assume that flake8 made their mind about this, my preference would go to disable W503 only.

I'll add a pointer to this issue to the things to discuss before next cookiecutter.

mirkobronzi commented 3 years ago

solved in #21