-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Possibility to implement flake8-length into ruff #4595
Comments
I think my preference would be to modify our existing rule rather than add multiple line-length rules within Ruff itself. Same goes for flake8-bugbear's variant that allows a 10% buffer. E.g., we do allow long lines that end in URLs, as long as the URL starts before the length limit (which differs from pycodestyle). We also allow lines that consistent of a single token without whitespace to break it up. What other behaviors or exceptions might you find helpful in our check? |
Hi Charlie, Ideally for me, an "intelligent" line length checker should ignore these situations:
flake8-length can do both, which is why I like it. Also, the violation code of flake8-length is |
Flake8-length allows:
The motivation is described in the README, but in short, these are things you want to keep unbroken for the sake of grep'ability. It also allows certain symbols and tokens to appear after the string. So, There is also a specific exception for raw SQL queries. SQL allows newlines between tokens, so they can be safely reformatted into a multiline string literal. I guess that's it. The parser's source code is just about 100 lines. |
I have tried
|
The point of flake8-length is to not remove the line length limit for the code. From the README:
|
Yes, the point being that It will wrap anything except for very long strings and comments. And the If you take |
@stinodego I agree that black takes care of that, but it adds a large overhead. There's a project I worked on which had about 200~ files, with some of them being very large, and running ruff was shorter than a blink of an eye but running black against all those files felt like an eternity compared to that (and it was quite long without comparison too - about 8 seconds). That's just because ruff doesn't ignore comments and other examples given above regarding It would be really useful for ruff to be able to support those features, then I would be able to use black only as a formatting tool and not as a linting tool just for E501. |
We're looking to switch from flake8 to ruff, but we would like to keep the behaviour that flake8-length gives. So I'd like to add my vote to adding it as a plugin. |
Hi,
I've found that flake8-length written by @orsinium to be one of my favorite flake8 plugins. I searched the issue pool of ruff and didn't find anyone mentioning it.
Thank you!
The text was updated successfully, but these errors were encountered: