From 0d74e95e8d80c0c64041476f71e41e27ced6e7a5 Mon Sep 17 00:00:00 2001 From: Roni Choudhury Date: Wed, 23 Oct 2024 10:07:22 -0400 Subject: [PATCH] Use pre-commit in tox configuration --- .pre-commit-config.yaml | 13 +++++++++++++ tox.ini | 16 ++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9ac085fb..76ebba42d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,5 +19,18 @@ repos: hooks: # Run the linter. - id: ruff + # Run the formatter. - id: ruff-format + + # Run the linter in fix-only mode. + - id: ruff + alias: ruff-fix-only + stages: [manual] + args: [--fix-only] + + # Run the formatter in check mode. + - id: ruff-format + alias: ruff-format-check + stages: [manual] + args: [--check] diff --git a/tox.ini b/tox.ini index 26e310864..6b4f193c0 100644 --- a/tox.ini +++ b/tox.ini @@ -11,22 +11,18 @@ envlist = package = skip ignore_errors = True deps = - codespell~=2.0 - ruff~=0.6.2 + pre-commit commands = - ruff --version - ruff check - ruff format --check - codespell . + pre-commit run --all-files codespell + pre-commit run --all-files --hook-stage manual ruff-format-check [testenv:format] package = skip deps = - ruff~=0.6.2 + pre-commit commands = - ruff --version - ruff check --fix-only - ruff format + pre-commit run --all-files --hook-stage manual ruff-fix-only + pre-commit run --all-files ruff-format [testenv:type] deps =