summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2021-12-14 23:54:58 +0100
committerGitHub <noreply@github.com>2021-12-14 23:54:58 +0100
commit39dc44bfa5fbb9500166b3480295379602e5bbc5 (patch)
treeee785ba8d9e189fb2b1bffda19492414cd7c0d2c /Makefile
parentb490b5d51af6ed29709c357a00fcdb6bda26df78 (diff)
downloadpsutil-39dc44bfa5fbb9500166b3480295379602e5bbc5.tar.gz
Automatically sort imports (isort CLI tool) (#2033)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 18 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 01512b7c..0ab1ea06 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ DEPS = \
coverage \
flake8 \
flake8-print \
+ isort \
pyperf \
pypinfo \
requests \
@@ -187,19 +188,30 @@ test-coverage: ## Run test coverage.
# Linters
# ===================================================================
-lint-py: ## Run Python (flake8) linter.
+check-flake8: ## Run flake8 linter.
@git ls-files '*.py' | xargs $(PYTHON) -m flake8 --config=.flake8
-lint-c: ## Run C linter.
+check-imports: ## Run isort linter.
+ @git ls-files '*.py' | xargs $(PYTHON) -m isort --settings=.isort.cfg --check-only
+
+check-c-code: ## Run C linter.
@git ls-files '*.c' '*.h' | xargs $(PYTHON) scripts/internal/clinter.py
-lint: ## Run Python (flake8) and C linters.
- ${MAKE} lint-py
- ${MAKE} lint-c
+lint: ## Run all linters
+ ${MAKE} check-flake8
+ ${MAKE} check-imports
+ ${MAKE} check-c-code
-fix-lint: ## Attempt to automatically fix some Python lint issues.
+# ===================================================================
+# Fixers
+# ===================================================================
+
+fix-flake8: ## Attempt to automatically fix some Python flake8 issues.
@git ls-files | grep \\.py$ | xargs $(PYTHON) -m flake8 --exit-zero | $(PYTHON) scripts/internal/fix_flake8.py
+fix-imports: ## Fix imports with isort.
+ @git ls-files '*.py' | xargs $(PYTHON) -m isort --settings=.isort.cfg
+
# ===================================================================
# GIT
# ===================================================================