From 7bc0129f943997b231e9fa5fe85ee2904ccad4ce Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Thu, 31 Aug 2023 14:25:03 +0300 Subject: [PATCH] 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. --- Makefile | 8 ++++---- pyproject.toml | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 04baeed..4fdb401 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,19 @@ JUNIT_FLAGS := --capture=sys -o junit_logging=all .PHONY: lint-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 lint-black-apply: ## apply black's source code formatting suggestions - black --exclude dev_scripts/envs --exclude $(LARGE_TEST_REPO_DIR) ./ + black ./ .PHONY: lint-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 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 \ --disallow-incomplete-defs \ diff --git a/pyproject.toml b/pyproject.toml index 49cad2e..65d0032 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,9 @@ strip-ansi = "*" [tool.isort] profile = "black" +skip = [".gitignore"] +# This is necessary due to https://github.com/PyCQA/isort/issues/1835 +follow_links = false [build-system] requires = ["poetry>=1.1.4"]