How do I isort using ruff?
Asked Answered
N

1

10

I often work in very small projects which do not have config file. How do I use ruff in place of isort to sort the imports? I know that the following command is roughly equivalent to black:

ruff format .

The format command do not sort the imports. How do I do that?

Nyctaginaceous answered 13/3 at 21:5 Comment(0)
C
23

According to the documentation:

Currently, the Ruff formatter does not sort imports. In order to both sort imports and format, call the Ruff linter and then the formatter:

ruff check --select I --fix .
ruff format .
Care answered 13/3 at 21:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.