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 ignore=E203 to flake8 #183

Merged
merged 4 commits into from
Nov 13, 2023
Merged

add ignore=E203 to flake8 #183

merged 4 commits into from
Nov 13, 2023

Conversation

MikeChen012345
Copy link
Contributor

The line "ignore = E203" is added to the setup.cfg file such that the conflict between flake8 and black can be resolved. The error is raised by flake8 when it detects whitespace before ':' which is against PEP 8 style guide recommendations for slices.
However, there's a known discrepancy between flake8 and black regarding this specific rule. black formats code with whitespace before and after the colon in slices for better readability, while flake8 raises a warning for this.

@MikeChen012345 MikeChen012345 added the dependencies Pull requests that update a dependency file label Nov 11, 2023
@MikeChen012345 MikeChen012345 added this to the 2023/Sprint 2 milestone Nov 11, 2023
@MikeChen012345 MikeChen012345 self-assigned this Nov 11, 2023
@MuyanXie MuyanXie assigned MuyanXie and unassigned MuyanXie Nov 11, 2023
@borjasotomayor
Copy link
Member

This looks good to me but, for future reference, can you provide a link to where this is called out as a "known discrepancy"?

@borjasotomayor
Copy link
Member

Please also provide more details on why W=503 was added (you can just include the explanation you provided on Slack)

@MikeChen012345
Copy link
Contributor Author

The W503 warning is raised by flake8 when it detects a line break before a binary operator. This was once against PEP 8 recommendations, which suggested that line breaks should occur after the binary operator.
However, PEP 8 was updated and now recommends that line breaks should occur before the binary operator. This makes the code more readable.

@MikeChen012345
Copy link
Contributor Author

The E203 error was discussed in a bunch of issues. Below are two of them:
PyCQA/pycodestyle#373
psf/black#280

And the W503 error was discussed here:
https://www.flake8rules.com/rules/W503.html

Copy link
Member

@borjasotomayor borjasotomayor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional information. This change looks good to me.

Copy link
Contributor

@elizabethli31 elizabethli31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Please update with dev and I'll merge.

@elizabethli31 elizabethli31 merged commit ed46223 into dev Nov 13, 2023
2 checks passed
@elizabethli31
Copy link
Contributor

elizabethli31 commented Nov 25, 2023

Issue Score: Excellent

Comments:
Good job flagging and fixing this! General change still needs a closing statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants