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

Lint when line characters are higher than maximum #1334

Closed
DataHearth opened this issue Dec 22, 2022 · 6 comments
Closed

Lint when line characters are higher than maximum #1334

DataHearth opened this issue Dec 22, 2022 · 6 comments
Labels
question Asking for support or clarification

Comments

@DataHearth
Copy link

Hey!

I'm now fully using ruff in my python projects as linter and try to integrate it everywhere in my client's projects. Works like a charm and it's fast!

I'm still using black as linter sometime because I need to format a line which exceeds the maximum line length. Unfortunately ruff doesn't not have this type of linting outside of the warning.

Is this a planned feature ? I can land a hand to implement this feature if it's interesting for the ruff project 👍.

Thanks for you awesome work!

@charliermarsh
Copy link
Member

Hey, thank you! Are you referring to the ability to reformat lines, in the event that they exceed the maximum line length?

@charliermarsh charliermarsh added the question Asking for support or clarification label Dec 23, 2022
@DataHearth
Copy link
Author

DataHearth commented Dec 23, 2022

exactly, here's an example with black formatting long lines:

def func():
    print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")

then

def func():
    print(
        "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
    )

The text itself has a linebreak after the first parenthesis and before the last one after linting. It is not the best example, I don't have a clean project rn to demonstrate it :). To resume, when line_length > max_line_length => format the line to be shorter (multiple lines, etc).

@nefrob
Copy link
Contributor

nefrob commented Dec 30, 2022

+1 on this.

@charliermarsh
Copy link
Member

I do want to support this! But it requires expanding Ruff into a full autoformatter. Which is in-scope, but larger than a single Issue.

@DataHearth
Copy link
Author

@charliermarsh is there already an epic issue for this topic ? If you need help on this, I can land a hand 🙂

@charliermarsh
Copy link
Member

Closing for now in favor of #1904!

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

No branches or pull requests

3 participants