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

Improve documentation on import sorting #8367

Closed
zanieb opened this issue Oct 30, 2023 · 2 comments · Fixed by #9117
Closed

Improve documentation on import sorting #8367

zanieb opened this issue Oct 30, 2023 · 2 comments · Fixed by #9117
Labels
configuration Related to settings and configuration documentation Improvements or additions to documentation

Comments

@zanieb
Copy link
Member

zanieb commented Oct 30, 2023

We've seen a lot of confusion about the relationship of import sorting with the linter and formatter. In the future, this situation may be improved i.e. by #8232 but until then it'd be great to have some clear guides in the documentation about how these currently interact and a recipe for enabling import sorting in projects.

@bluthej
Copy link
Contributor

bluthej commented Dec 9, 2023

I ran into that a few days ago and ended up tweaking my helix config to have both format and import sorting on save. I'd very much like to help out on this issue if you're looking for some hands on this!

Right now I'm following what I've found on some other thread, which consists in piping the result of a call to ruff check (which sorts imports) to a call to ruff format (which does the rest of the formatting). Is that the kind of config you would like to be documented? Or did you have something a bit cleaner in mind? Ideally if there's a way to do both in a single call to Ruff that'd be great but AFAIK this is not doable right now.

@zanieb
Copy link
Member Author

zanieb commented Dec 11, 2023

I think we'd just want to document that ruff format does not sort imports and then give a minimal setup that does both e.g. maybe

ruff check --select I --fix
ruff format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants