Closed rwarren closed 5 months ago
Thanks, though I think this is a duplicate of #3206?
... not sure how I missed #3206!! 🤦 It is a duplicate.
I think this is because I landed here after finding #4048 (about use_parentheses
) and re-targeted the report while writing it.
Rationale here is basically in support of #3206. Shall I move the text over there?
Ruff version: 0.4.3
Request in short:
It would be nice if Ruff's
isort
implementation supported isort'sline_length
setting independently from Ruff's globalline-length
setting.The width threshold used for warning about line length issues should not exactly match the value used for automatic formatting (line wrapping). Warnings and auto-formatting are different things and it would be nice if Ruff didn't rigidly couple them.
This could be done here by just adding support for
line_length
in thelint.isort
settings.Rationale:
I use Ruff for linting, but do not use it for overall file formatting. I do use Ruff's embedded
isort
formatting extensively.For linting the line length:
E501
) according to Ruff'sline-length
settingline-length
to be fairly long (150) to allow for edge cases when it just happens (e.g. an inline comment extending a few characters past normal expected line width)For automatic line length formatting:
black
would doIn most cases long
from ... import ...
lines shouldn't happen in a code base, but (aside from this being a style choice) it is common in some libraries like PySide6, where lines like this are common:The
isort
implementation nicely generated that line... but it is too long because the linterline-length
threshold is intentionally long, and Ruff is wrapping using it.