Description
Describe the bug
We have Django files/settings that have intentional import ordering to avoid issues. Hence, we exclude them when fixing the imports using isort
via skip_glob
option.
This is the relevant setting in pyproject.toml
(--isort
option is set in it):
[tool.darker]
isort = true # Run the `isort` also when running `darker`.
[tool.isort]
# https://pycqa.github.io/isort/docs/configuration/options.html
skip_glob = ['*/conf/settings/*'] # Exclude the Settings files due to sensitive imports.
filter_files = true # Exclude the file if applicable even if it's explicitly specified.
Using isort
works (i.e. the applicable file is excluded):
$ isort conf/settings/backoffice.py --diff
Skipped 1 files
However, using darker
will still show the --isort
diff which is unexpected:
$ darker conf/settings/backoffice.py --diff
...
To Reproduce
Basically, edit a Python file that is part of the skip_glob
pattern. Notice that darker
will not exclude it when fixing imports.
Expected behavior
Just like the stand-alone isort
, darker --isort
should exclude the file since it's skipped via glob.
Environment
- OS: macOS 12.5 Monterey
- Python version: 3.11.0
- Git version: 2.39.1
- Darker version: 2.1.1
- Black version: 24.4.2
- Isort version: 5.13.2
Note that when using darker
via pre-commit
, it's the same issue: those supposed to be skipped files via glob pattern are still being linted by the --isort
option which is unexpected.
PS: Thanks for this excellent project. :)
Metadata
Metadata
Assignees
Labels
Projects
Status