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

feature: per file line-length. #13443

Closed
toppk opened this issue Sep 22, 2024 · 3 comments
Closed

feature: per file line-length. #13443

toppk opened this issue Sep 22, 2024 · 3 comments

Comments

@toppk
Copy link

toppk commented Sep 22, 2024

using ruff 0.5.1 I don't think there's a way to have a different line-length setting per file. I can disable E501, but I cannot tweak it, for the occasional file the just has a lot of little bit too long lines. like I'm okay with 100 instead of 88, but not 120, this would be really hard to do in pyproject.toml, but I'm hoping some at least we could get a pragma for the top of a file. e.g. # ruff: setting: line-length: 98

this is especially annoying working with AI because it doesn't know how to generate short lines.

@MichaReiser
Copy link
Member

I think this is similar to #7696 and I propose that we merge the issues. The main difference is that you propose the use of pragma comments.

Are all these files that need a longer line length in the same directory? If so, then you can add a new ruff.toml inside that directory, set it to extend = <base_config_path> your base configuration and change the line-length. Ruff then applies this configuration to all files in that directory (and its sub-directories)

Another alternative is to use ruff format which breaks the lines for you (or your AI ;)).

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2024
@toppk
Copy link
Author

toppk commented Sep 27, 2024

Another alternative is to use ruff format which breaks the lines for you (or your AI ;)).

it's those f-strings that i'm always having to fix up. ruff format does fine with the rest.

@MichaReiser
Copy link
Member

You can enable ruff.format.preview to get f-string formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants