isort: isort does not skip files
Describe the bug
isort does not respect skip and skip_glob configuration options.
To Reproduce
Steps to reproduce the behavior:
- Create
file.pywith the following content:import os, \ sys - Create
.isort.cfgwith the following content:[settings] skip_glob = file.py - Run
isort file.py. - Open
file.pyand check out it’s content to become:import os import sys
Expected behavior
A file.py is skipped and is not touched.
Screenshots
—
Environment (please complete the following information):
- OS: Linux
- Python version: 3.7.2
- isort version: 4.3.11
Additional context
isort 4.3.10 is working correctly. Issue can be reproduced with skip option as well.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 18
- Comments: 29 (17 by maintainers)
Commits related to this issue
- Use known good version of isort See https://github.com/timothycrosley/isort/issues/885 — committed to Karaage-Cluster/karaage by brianmay 5 years ago
- Pin isort version in CI (#679) ## Problem isort had a regression in 4.3.11 that it no longer respects `skip_glob` as we intended. See https://github.com/timothycrosley/isort/issues/885. This moti... — committed to pex-tool/pex by Eric-Arellano 5 years ago
- fix(pre-commit): fix file passing errors `pre-commit` is known to override behavior from config files in certain instances. This commit fixes known issues for: - `isort` - `black` - `mypy` For rele... — committed to adam-grant-hendry/pyvistaqt by adamgranthendry 2 years ago
- fix(pre-commit): fix file passing errors `pre-commit` is known to override behavior from config files in certain instances. This commit fixes known issues for: - `isort` - `black` - `mypy` - `pydocs... — committed to adam-grant-hendry/pyvistaqt by adamgranthendry 2 years ago
- Update Formatting Tools (#182) * refactor(trove-classifiers): update to python 3.7-3.9 * refactor(linters): add `.flake8` and `.codespellrc` configuration files Also add `PullRequest` to `ignor... — committed to pyvista/pyvistaqt by adam-grant-hendry 2 years ago
I’m sorry for letting this regression slip in the last release! It took a while for me to untangle, but it should be fixed in the latest release (4.3.13) of isort, with additional testing put in place to try to ensure the regression is not reintroduced on the future.
Thanks!
~Timothy
@jparise,
Completely agree! I believe 4.3.18 may have included the exact flag that you are hoping for:
https://github.com/timothycrosley/isort/blob/develop/CHANGELOG.md#4318---may-1-2019---hot-fix-release:
--filter-filesThanks!
~Timothy
There does appear to be a regression here. In version 4.3.10 the following works:
In version 4.3.11 it now processes files such as
karaage/migrations/0002_auto_20140924_1111.py. Will try to narrow it down to the commit.Thanks for the tool, its great!
I believe the following should work for you:
isort --check-only ~/Projects/foo/config/settings/base.py -vb --settings-path /Users/Silver/Projects/foo/ --filter-filesOh, it drives me mad 😃
My
setup.cfglocated in ~/Projects/foo with the following contents:There is no .isort.cfg anywhere and neither .editorconfig contains anything related to isort.
Observed problem: Files within
~/Projects/foo/config/settings/are not skipped. I’ve tried several combinations and it never works:isort version: 4.3.21 @timothycrosley what I’m doing wrong?
Forget what I just said (and deleted). Me confused.
First bad commit is 2c59158602f5d36d88c32cefe7e14a3963068c9e in #878.
Note this commit was hard to test, because it contained unrelated errors fixed in subsequent commits.
Hi @timothycrosley
we rely on this behavior in our project. Our use case is next:
*/migrations/*to skip imports codestyle check for auto-generated migrations all the timeDoes that make sense?