diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 45c1f3c5f08..88bf6a832bf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,10 @@ repos: + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.252' + hooks: + - id: ruff + args: + - --fix - repo: https://github.com/psf/black rev: 23.1.0 hooks: @@ -8,42 +14,12 @@ repos: files: \.py$ types: [] - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - - - repo: https://github.com/PyCQA/bandit - rev: 1.7.4 - hooks: - - id: bandit - args: [--severity-level=high] - files: ^src/ - - - repo: https://github.com/asottile/yesqa - rev: v1.4.0 - hooks: - - id: yesqa - - repo: https://github.com/Lucas-C/pre-commit-hooks rev: v1.4.2 hooks: - id: remove-tabs exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$) - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - additional_dependencies: - [flake8-2020, flake8-errmsg, flake8-implicit-str-concat] - - - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.10.0 - hooks: - - id: python-check-blanket-noqa - - id: rst-backticks - - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: diff --git a/Makefile b/Makefile index a2545b54e61..1d53ea1341d 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ help: @echo " install make and install" @echo " install-coverage make and install with C coverage" @echo " lint run the lint checks" - @echo " lint-fix run Black and isort to (mostly) fix lint issues" + @echo " lint-fix run ruff to (mostly) fix lint issues" @echo " release-test run code and package tests before release" @echo " test run tests on installed Pillow" @@ -114,7 +114,4 @@ lint: .PHONY: lint-fix lint-fix: - python3 -c "import black" > /dev/null 2>&1 || python3 -m pip install black - python3 -c "import isort" > /dev/null 2>&1 || python3 -m pip install isort - python3 -m black --target-version py37 . - python3 -m isort . + ruff --fix . \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 824cae08845..e9525db9e47 100644 --- a/setup.cfg +++ b/setup.cfg @@ -63,13 +63,6 @@ tests = pytest-cov pytest-timeout -[flake8] -extend-ignore = E203 -max-line-length = 88 - -[isort] -profile = black - [tool:pytest] addopts = -ra --color=yes testpaths = Tests diff --git a/setup.py b/setup.py index 8f7f223f8cd..7402f9f61d9 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def get_version(): version_file = "src/PIL/_version.py" with open(version_file, encoding="utf-8") as f: - exec(compile(f.read(), version_file, "exec")) + exec(compile(f.read(), version_file, "exec")) # noqa: S102 return locals()["__version__"]