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

Smart handling of lines that are too long #8428

Closed
pitosalas opened this issue Nov 2, 2023 · 5 comments
Closed

Smart handling of lines that are too long #8428

pitosalas opened this issue Nov 2, 2023 · 5 comments
Labels
formatter Related to the formatter question Asking for support or clarification

Comments

@pitosalas
Copy link

pitosalas commented Nov 2, 2023

In my code I have some lines which are too long. Perhaps it's a long f string for output or a long expression. It would be nice if ruff did some smart things to deal with the too long lines in a way that looks good. For example turning the string into several concatenated strings or something. Is that possible?

I have tried various pyproject.toml settings but they don't seem to have any effect. Maybe that's my problem>?

@zanieb
Copy link
Member

zanieb commented Nov 2, 2023

This is available in Black's preview style (psf/black#182) and we are working on an implementation for it — but it's a difficult feature to get correct.

@zanieb zanieb added the formatter Related to the formatter label Nov 2, 2023
@MichaReiser
Copy link
Member

@pitosalas are you using ruff's formatter or is this feedback related to E501 (line-too-long) rule?

@pitosalas
Copy link
Author

@MichaReiser Honestly I am not sure. This is my first use of ruff. But my intent is that the formatter notices a line too long and does semi-intelligent things with indentation and even notational changes to make the line not be too long anymore.

@charliermarsh
Copy link
Member

@pitosalas - Have you tried running ruff format instead of ruff check? That will attempt to wrap lines for you.

@charliermarsh charliermarsh added the question Asking for support or clarification label Nov 2, 2023
@charliermarsh
Copy link
Member

Gonna close for now in the absence of more info, but recommend trying out ruff format!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

4 participants