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

Suggestion: include ruff's isort lint rule #2

Open
bradzacher opened this issue Nov 23, 2023 · 3 comments
Open

Suggestion: include ruff's isort lint rule #2

bradzacher opened this issue Nov 23, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@bradzacher
Copy link

https://docs.astral.sh/ruff/rules/#isort-i
https://docs.astral.sh/ruff/settings/#isort

At Canva we currently use dprint-plugin-exec to run both black and isort over the codebase.
I'm not sure how common this is externally - but I believe it's not uncommon to run both black + isort on a python codebase together - treating isort as a second formatter of sorts.

Ruff supports import sorting - so it would be great if we could leverage this and eliminate one more (slow) integration from the exec plugin.

@dsherret dsherret added the enhancement New feature or request label Nov 23, 2023
@bradzacher
Copy link
Author

For reference formatting ~5k files

  • dprint-plugin-ruff plus isort via dprint-plugin-exec: ~2m30s.
  • just dprint-plugin-ruff: ~12s

So there's a massive potential perf win here!

@dsherret
Copy link
Member

I was also thinking about this, but I'm not sure how difficult it would be to implement (haven't looked into it and just going to sleep). Worst case, a pass on the CST could be done before or after formatting that does it.

@davo-canva
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants