diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-01 12:24:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 12:24:59 +0200 |
commit | 7eadee31db2f038763a3a6f978db1ea76bbc4674 (patch) | |
tree | 55d75da147cc3a40b989e18df1126de5167b66cf /Makefile | |
parent | 7d55ce4e3d81705264398a15ffaa1896f4e1aefc (diff) | |
download | psutil-7eadee31db2f038763a3a6f978db1ea76bbc4674.tar.gz |
Fix pylint warnings / cleanup (#2218)
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -22,6 +22,7 @@ PY3_DEPS = \ flake8-quotes \ isort \ pep8-naming \ + pylint \ pyperf \ pypinfo \ requests \ @@ -36,6 +37,7 @@ PY2_DEPS = \ mock PY_DEPS = `$(PYTHON) -c \ "import sys; print('$(PY3_DEPS)' if sys.version_info[0] == 3 else '$(PY2_DEPS)')"` +NUM_WORKERS = `$(PYTHON) -c "import os; print(os.cpu_count() or 1)"` # "python3 setup.py build" can be parallelized on Python >= 3.6. BUILD_OPTS = `$(PYTHON) -c \ "import sys, os; \ @@ -191,10 +193,13 @@ test-coverage: ## Run test coverage. # =================================================================== flake8: ## Run flake8 linter. - @git ls-files '*.py' | xargs $(PYTHON) -m flake8 --config=.flake8 + @git ls-files '*.py' | xargs $(PYTHON) -m flake8 --config=.flake8 --jobs=${NUM_WORKERS} isort: ## Run isort linter. - @git ls-files '*.py' | xargs $(PYTHON) -m isort --check-only + @git ls-files '*.py' | xargs $(PYTHON) -m isort --check-only --jobs=${NUM_WORKERS} + +pylint: ## Python pylint (not mandatory, just run it from time to time) + @git ls-files '*.py' | xargs $(PYTHON) -m pylint --rcfile=pyproject.toml --jobs=${NUM_WORKERS} c-linter: ## Run C linter. @git ls-files '*.c' '*.h' | xargs $(PYTHON) scripts/internal/clinter.py @@ -209,11 +214,11 @@ lint-all: ## Run all linters # =================================================================== fix-flake8: ## Run autopep8, fix some Python flake8 / pep8 issues. - @git ls-files '*.py' | xargs $(PYTHON) -m autopep8 --in-place --jobs 0 --global-config=.flake8 - @git ls-files '*.py' | xargs $(PYTHON) -m autoflake --in-place --jobs 0 --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys + @git ls-files '*.py' | xargs $(PYTHON) -m autopep8 --in-place --jobs=${NUM_WORKERS} --global-config=.flake8 + @git ls-files '*.py' | xargs $(PYTHON) -m autoflake --in-place --jobs=${NUM_WORKERS} --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys fix-imports: ## Fix imports with isort. - @git ls-files '*.py' | xargs $(PYTHON) -m isort + @git ls-files '*.py' | xargs $(PYTHON) -m isort --jobs=${NUM_WORKERS} fix-all: ## Run all code fixers. ${MAKE} fix-flake8 |