Disable change to dangling commas on imports
lynxoid opened this issue · comments
We are using add-trailing-comma
for dangling commas and isort
to keep our imports organized. Ideally, both can run as pre-commit hooks. However, the two tools clash on statements like this:
from my_library.api.database.models import (Model1, Model2, Model3, Model4, Model5, Model6
Model7,)
where isort
prefers this style and add-trailing-comma
reformats it into:
from my_library.api.database.models import (
Model1, Model2, Model3, Model4, Model5, Model6
Model7,
)
When trying to commit, no matter the order between isort
and add-trailing-comma
, the imports are always re-arranged, preventing commit. Disabling add-trailing-comma
on imports would allow us to run isort and to use your tool for other parts of the file.
you're looking for the include_trailing_comma
option to isort
or profile = black
will also work
Thanks! We already had include_trailing_comma=True
, but adding profile=black
solved it.
cheers! glad that helped!