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

Rule E203 conflicts with formatter #8642

Closed
ofek opened this issue Nov 13, 2023 · 3 comments · Fixed by #8654
Closed

Rule E203 conflicts with formatter #8642

ofek opened this issue Nov 13, 2023 · 3 comments · Fixed by #8654
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ofek
Copy link
Contributor

ofek commented Nov 13, 2023

Running the formatter on

release_lines = history_file_lines[history_file_lines.index('## Unreleased') + 1: -1]

produces

release_lines = history_file_lines[history_file_lines.index('## Unreleased') + 1 : -1]

which then fails the rule

scripts\utils.py:22:85: E203 Whitespace before ':'

Is the fix simply to document that here? https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

@charliermarsh
Copy link
Member

I will add it to that list, though there's an open issue to fix the rule to allow this: #7259.

@charliermarsh
Copy link
Member

I decided to just fix it instead.

@ofek
Copy link
Contributor Author

ofek commented Nov 13, 2023

Oh nice that's much better, thanks!

charliermarsh added a commit that referenced this issue Nov 13, 2023
…ation` (`E203`) (#8654)

## Summary

This PR makes `whitespace-before-punctuation` (`E203`) compatible with
the formatter by relaxing the rule a bit, as compared to the pycodestyle
implementation. It's also more consistent with PEP 8, which says:

> However, in a slice the colon acts like a binary operator, and should
have equal amounts on either side (treating it as the operator with the
lowest priority).

Closes #7259.
Closes #8642.

## Test Plan

`cargo test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants