django project: isort ignores local .cfg file's "skip" parameter

154 Views Asked by At

I'm using "isort" in my Django project and the problem is when I make the isort command on the project level it ignores app-level ".isort.cfg" file's skip parameters.

My isort version is 5.11.4. The local/app level ".isort.cfg" file:

[settings]
known_django=django
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
skip=migrations

How to force it to not ignore nested folders cfg files?

Results for command "isort . --resolve-all-configs --verbose " is a long list(no errors) like following: ./orders/.isort.cfg used for file ./orders/migrations/0001_initial.py ./orders/.isort.cfg used for file ./orders/migrations/init.py

As seen here it 'uses' app-level cfg file but 'migrations' files are not ignored as it should be according the app-level config.

1

There are 1 best solutions below

5
On

You can add --resolve-all-configs to your isort command. More information in the doc section Supporting multiple config files in single isort run.

For example in my multi-app django-project I have a .isort.cfg at root level, and I added the .isort.cfg file in my settings folder. Here is the output I get with following command: isort --verbose --resolve-all-configs .

.\.isort.cfg used for file .\project\views\project.py # root config file
.\settings\.isort.cfg used for file .\settings\asgi.py # nested config file