Skip to content

[skip changelog] Resolve impossible to satisfy Flake8 configuration #1022

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

Merged
merged 1 commit into from
Oct 12, 2020
Merged

[skip changelog] Resolve impossible to satisfy Flake8 configuration #1022

merged 1 commit into from
Oct 12, 2020

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Oct 10, 2020

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce?

Bug fix.

  • What is the current behavior?

Flake8/pycodestyle has a pair of mutually exclusive checks:

  • W503: line break before binary operator
  • W504: line break after binary operator

Having both these checks enabled results in a failed check when there is a line break at a binary operator, which can't be
resolved by moving the operator.

if (
    some_long_condition
    and some_other_long_condition
):

fails the W503 check.

if (
    some_long_condition and
    some_other_long_condition
):

fails the W504 check.

  • What is the new behavior?

PEP 8 recommends line break before the binary operator, so the logical choice of which of the two checks to keep is W504.

Flake8 is now configured to ignore W503 and it is possible to format the Python code in a way that will pass the check.

  • Does this PR introduce a breaking change?

No

Flake8/pycodestyle has a pair of mutually exclusive checks:

- W503: 	line break before binary operator
- W504: 	line break after binary operator

Having both these checks enabled results in a failed check when there is a line break at a binary operator that can't be
resolved by moving the operator.

PEP 8 recommends line break before the binary operator, so the logical choice between the two checks is W504.
@per1234 per1234 merged commit 1d1da06 into arduino:master Oct 12, 2020
@per1234 per1234 deleted the ignore-w503 branch October 12, 2020 06:46
@per1234 per1234 self-assigned this Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants