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

Mismatch with flake8 #3576

Closed
Mofef opened this issue Mar 17, 2023 · 5 comments
Closed

Mismatch with flake8 #3576

Mofef opened this issue Mar 17, 2023 · 5 comments

Comments

@Mofef
Copy link

Mofef commented Mar 17, 2023

I never really spend any thoughts on linting, I rather accepted that it was there, only since Charlies webinar with jetbrains I became interested and since I suggested to give ruff a try in our projects. Just as a disclaimer, most likely i'm just making a stupid mistake....

With this aside, what is the issue? As far as I understand flake8 and ruff should be pretty much consistent, but we found this:

(venv) moritz@VirtualBox:~/PycharmProjects/b.series$ flake8 bseries/
bseries/.....py:57:21: E225 missing whitespace around operator
bseries/.....py:170:41: E231 missing whitespace after ':'
bseries/.....py:7:1: E302 expected 2 blank lines, found 1
bseries/.....py:19:22: E127 continuation line over-indented for visual indent
(venv) moritz@VirtualBox:~/PycharmProjects/b.series$ ruff bseries/
(venv) moritz@VirtualBox:~/PycharmProjects/b.series$ 

are those just not implemented yet?

here is the snippet regarding the first flake8 error: (last line)

    def __getitem__(self, item):
        if not isinstance(item, slice):
            if isinstance(item, str):
                item=[item] 
(venv) moritz@VirtualBox:~/PycharmProjects/b.series$ ruff --version
ruff 0.0.246

pyproject.toml:

[tool.ruff]
select = ["E", "F", "I", "W"]
line-length = 120

setup.cfg

[flake8]
max-line-length = 120
extend-ignore = E203
@JonathanPlasse
Copy link
Contributor

These checks from flake8 are not yet available in Ruff.
It was not implemented as Black can fix these errors automatically.

@charliermarsh
Copy link
Member

Yup that's right! We haven't finished implementing those "stylistic" rules from Flake8, but we've made a bunch of progress on them.

If you try with a snippet like:

import os

def f():
  x = 1

You should see unused import and unused variable errors in both Flake8 and Ruff.

Thanks for giving Ruff a try :)

@Mofef
Copy link
Author

Mofef commented Mar 17, 2023

Awesome, thx for the heads up! Is there an easy way to check if rules are / are not implemented yet?

@charliermarsh
Copy link
Member

We're missing 13 rules (#2402), however some of the rules that are checked off in that issue are still behind a flag and not yet available in the release (coming soon).

So the place to look would be the E list in the docs, which you can compare to pycodestyle's own list. Sorry, I know it's not "easy" to compare those two sources!

@Mofef
Copy link
Author

Mofef commented Mar 18, 2023

Easy enough! 🚀 Thank you so much!

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

No branches or pull requests

3 participants