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

Support remaining pycodestyle rules #1073

Closed
horseinthesky opened this issue Dec 5, 2022 · 9 comments
Closed

Support remaining pycodestyle rules #1073

horseinthesky opened this issue Dec 5, 2022 · 9 comments
Labels
plugin Implementing a known but unsupported plugin

Comments

@horseinthesky
Copy link

horseinthesky commented Dec 5, 2022

Would be great to have these:

E201 whitespace after '['
E202 whitespace before ')'
E203 whitespace before ','
E211 whitespace before '('
E221 multiple spaces before operator
E301 expected 1 blank line, found 0
E302 expected 2 blank lines, found 1
E303 too many blank lines (4)
E401 multiple imports on one line
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Dec 5, 2022
@nanthony007
Copy link

I'm going to try to work on this one rule at a time. Just for clarity E201 is "whitespace after '('" according to pycodestyle docs here.

@horseinthesky
Copy link
Author

Awesome!

Docs mention E201 3 times with (, [ and {. So I assume it's just whitespace after any of them.

@nanthony007
Copy link

@charliermarsh First time contributing and I've never worked with ASTs before. I think I have some code in place but would welcome support on this. I could open a PR to show what I have currently, if that is acceptable.

Basically stuck on the AST logic implementation and believe I have the rest in place.

@charliermarsh
Copy link
Member

@nanthony007 - Happy to help! Do you want to put up a draft PR with questions we can discuss in the context of the code? Or what would be most effective?

@nanthony007
Copy link

I can put up a PR and we can go through it there I think.

I was thinking that since the E3 series seems to be whitespace oriented it might be worth implementing them as a part of this issue as well.

@vytas7
Copy link

vytas7 commented Dec 15, 2022

Run into this as well when testing ruff on a relatively large, mostly legacy code base where it provides an immense speed boost over flake8; but we'll have to wait until basic stuff along the lines of E302 is supported.

Don't get me wrong, I do think ruff is fantastic, and I'm planning to adopt it soon both in various hobby projects and at work, but maybe "near-parity with Flake8" is a bit misleading for the time being?

@charliermarsh
Copy link
Member

@vytas7 - Appreciate it!

We prioritized the rules based on the assumption that Ruff would be used alongside Black -- so we just haven't focused on implementing rules like E302 that are made obsolete by an autoformatter. (It doesn't mean we won't implement them, just that they weren't / haven't been prioritized.) That's one of the key assumptions baked into any "parity with Flake8" claims. I hope it doesn't come across as misleading, it's all documented in the FAQ, definitely not my intent.

@rochacbruno
Copy link

I was also looking for it, those messages are useful when teaching.

I will need to use ruff + flake8 for a while

@charliermarsh charliermarsh added plugin Implementing a known but unsupported plugin and removed rule Implementing or modifying a lint rule labels Dec 31, 2022
@charliermarsh
Copy link
Member

Closing in favor of #2402, which is the same issue but includes the rule tabulation up top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Implementing a known but unsupported plugin
Projects
None yet
Development

No branches or pull requests

5 participants