Let black and isort respect .gitignore

In order to let isort respect .gitignore, we need to specify this in the
tool.isort entry, in pyproject.toml.

For black, we don't need any extra tweaks. This is weird, since until a
few months ago black did not respect .gitignore. Maybe something has
changed in the meantime but if not, we should revert this change.
This commit is contained in:
Alex Pyrgiotis 2023-08-31 14:25:03 +03:00
parent 29c0181b4d
commit 7bc0129f94
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
2 changed files with 7 additions and 4 deletions

View file

@ -4,19 +4,19 @@ JUNIT_FLAGS := --capture=sys -o junit_logging=all
.PHONY: lint-black .PHONY: lint-black
lint-black: ## check python source code formatting issues, with black lint-black: ## check python source code formatting issues, with black
black --check --diff --exclude dev_scripts/envs --exclude $(LARGE_TEST_REPO_DIR) ./ black --check --diff ./
.PHONY: lint-black-apply .PHONY: lint-black-apply
lint-black-apply: ## apply black's source code formatting suggestions lint-black-apply: ## apply black's source code formatting suggestions
black --exclude dev_scripts/envs --exclude $(LARGE_TEST_REPO_DIR) ./ black ./
.PHONY: lint-isort .PHONY: lint-isort
lint-isort: ## check imports are organized, with isort lint-isort: ## check imports are organized, with isort
isort --check-only --skip dev_scripts/envs --skip $(LARGE_TEST_REPO_DIR) ./ isort --check --diff ./
.PHONY: lint-isort-apply .PHONY: lint-isort-apply
lint-isort-apply: ## apply isort's imports organization suggestions lint-isort-apply: ## apply isort's imports organization suggestions
isort --skip dev_scripts/envs --skip $(LARGE_TEST_REPO_DIR) ./ isort ./
MYPY_ARGS := --ignore-missing-imports \ MYPY_ARGS := --ignore-missing-imports \
--disallow-incomplete-defs \ --disallow-incomplete-defs \

View file

@ -47,6 +47,9 @@ strip-ansi = "*"
[tool.isort] [tool.isort]
profile = "black" profile = "black"
skip = [".gitignore"]
# This is necessary due to https://github.com/PyCQA/isort/issues/1835
follow_links = false
[build-system] [build-system]
requires = ["poetry>=1.1.4"] requires = ["poetry>=1.1.4"]