You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the pre-commit hooks, isort may conflict with black. The problem is that isort sometimes reorders differently than black. This leads to failure of the pre-commit test because the change that is made by black is immediately reversed by isort.
In the end, no file has been changed but the test thinks it failed.
This behaviour can be circumvented by forcing isort to be cautious about changes made by black.
One can add --profile black.
This could either be done in .pre-commit-config.yaml:
Associated Template/Command/Core
cookietemple create -> cli -> python
Describe the bug
When running the pre-commit hooks, isort may conflict with black. The problem is that isort sometimes reorders differently than black. This leads to failure of the pre-commit test because the change that is made by black is immediately reversed by isort.
In the end, no file has been changed but the test thinks it failed.
This behaviour can be circumvented by forcing isort to be cautious about changes made by black.
One can add
--profile black
.This could either be done in
.pre-commit-config.yaml
:or adding this to
pyproject.toml
in the default TEMPLATE:Further information: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html
To Reproduce
Steps to reproduce the behavior:
Not sure how to reproduce it exactly as I cannot remember what caused the conflict in my case.
But this issue provides an example: PyCQA/isort#1518
Expected behavior
Black and isort should both agree and agree at all times when executing the pre-commit hooks.
System [please complete the following information]:
Additional context
The text was updated successfully, but these errors were encountered: