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

Use max-line-length setting from flake8 #95

Closed
mschoettle opened this issue Aug 11, 2020 · 3 comments
Closed

Use max-line-length setting from flake8 #95

mschoettle opened this issue Aug 11, 2020 · 3 comments

Comments

@mschoettle
Copy link

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.

@gforcada
Copy link
Owner

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 🙂

@mschoettle
Copy link
Author

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.

@gforcada
Copy link
Owner

gforcada commented Nov 2, 2023

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? 😄

@gforcada gforcada closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants