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

isort: skip_glob option doesn't work #615

Open
ranelpadon opened this issue Aug 10, 2024 · 1 comment · May be fixed by #751
Open

isort: skip_glob option doesn't work #615

ranelpadon opened this issue Aug 10, 2024 · 1 comment · May be fixed by #751
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ranelpadon
Copy link
Collaborator

ranelpadon commented Aug 10, 2024

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. :)

@akaihola
Copy link
Owner

Thanks @ranelpadon for the detailed bug report! I will look into this issue.

@akaihola akaihola added the bug Something isn't working label Aug 25, 2024
@akaihola akaihola self-assigned this Aug 25, 2024
@akaihola akaihola added this to the Darker 3.0.1 milestone Aug 25, 2024
@akaihola akaihola linked a pull request Oct 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants