Use max-line-length setting from flake8
Closed this issue ยท 3 comments
In one of my files I have an import line that with a recent commit exceeded the length of 79
(the default line length in isort
).
For some reason, in my local environment (with virtualenv
) flake8
did not report any errors. However, my CI pipeline failed during the linting step/check reporting an error on the above mentioned line. After lots of digging I figured out that this is due to exceeding the max line length (e.g., running isort
in the Docker container that is used by the CI pipeline wrapped the imported classes in parentheses over multiple lines).
Is there a reason why inconsistent results could be produced in this case?
Adding line_length = n
to my config file fixed this problem.
Ideally, I feel that flake8-isort
should use the max-line-length
setting from flake8
and pass it to isort
.
Hi! ๐ thanks for using flake8-isort and on top of that taking the time to send your improvement proposals on it! ๐
To the topic at hand: ๐ค I'm not sure what would be best here... my usual train of thought is that if you use flake8-isort
is because you want isort
to keep your imports sorted on your project/company specific way, and for that you have hand-crafted/copied an isort
configuration that works for you.
With this train of thought in mind, one would then say that the imports line length should be set by isort
, otherwise when automatically sorting the imports with it, it would produce not the expected results.
I see the conflict of having an imports line length (potentially defined on isort configuration) vs a regular line length (defined on flake8).
I'm not sure what would be best here ๐ anyone else wants to share his/her opinions? ๐
P.D. @mschoettle at least until a final solution is found, you can always set a skip this line comment to avoid the discrepancy by now, so at least your pipeline is not blocked by this issue ๐
Thanks, @gforcada, for your thoughts on this. That makes sense to me.
I think for now the best solution therefore is to set the line-length
again.
Meanwhile, isort
got profiles and black
is the default formatter for python code, even ruff
was born to take flake8
over, so maybe this is a no issue already? ๐