From 7eadee31db2f038763a3a6f978db1ea76bbc4674 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sat, 1 Apr 2023 12:24:59 +0200 Subject: Fix pylint warnings / cleanup (#2218) --- Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f5472bf4..27bba266 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v1.2.1