Style guide fix for W503 W504#1382
Merged
LefterisJP merged 3 commits intoraiden-network:masterfrom Apr 25, 2018
Merged
Conversation
By having any ignore on setup.cfg both style rules were activated so we need to choose one. We go with the operator before the newline.
LefterisJP
added a commit
to loredanacirstea/raiden-contracts
that referenced
this pull request
Apr 24, 2018
Contributor
|
@LefterisJP , why not just add Ah, you would have a lot of violations, therefore a lot of code to change. Ok. |
hackaugusto
approved these changes
Apr 25, 2018
Contributor
Author
|
@loredanacirstea The good thing is that if we ever wanna change the style we just ignore |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All of a sudden flake8 started reporting a
W504violation for our code due to us putting the line break after the operator in long expressions with operators that were broken in multiple lines.This was introduced in the latest version of flake8 and made our code non flake8 compatible right under our noses.
I tried to change it to have the line break before the operator and then flake8 reported a
W503violation. Damned if you do, damned if you don't.That looked fishy so I did some digging:
PyCQA/pycodestyle#498
PyCQA/pycodestyle#502
Apparently this flake8 violation was considered opinionated and put in the default ignores. But there is a bug that if you have any ignores specified (which we do) then you lose all the default ignores.
Solution
Put
W504to the ignores, so that flake8 reports correctly when we ever make aW503violation. Add the rule that line breaks should come after the operator to the style guide.Note: This rule also applies to solidity code.