ruff
ruff copied to clipboard
Lint when line characters are higher than maximum
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!
Hey, thank you! Are you referring to the ability to reformat lines, in the event that they exceed the maximum line length?
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).
+1 on this.
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.
@charliermarsh is there already an epic issue for this topic ? If you need help on this, I can land a hand 🙂
Closing for now in favor of #1904!