diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4e39cdc3..aad11615 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -28,10 +28,10 @@ jobs: python-version: 3.13 - name: Install tox run: python -m pip install tox - - name: Run codespell - run: tox -e codespell - - name: Run code format checks - run: tox -e format_check + - name: Run pre-commit checks + uses: pre-commit/action@v3.0.1 + with: + extra_args: --all-files test: needs: diff --git a/pyproject.toml b/pyproject.toml index 54a5a2a9..68f9ccf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,8 @@ ignore-words-list = [ quiet-level = 3 # https://docs.astral.sh/ruff/settings/ [tool.ruff] -extend-exclude = [] +extend-exclude = [ +] force-exclude = true line-length = 120 # Assume Python 3.9 @@ -211,20 +212,17 @@ commands = [ ] [tool.tox.env.format] -description = "Run ruff code formatter." +description = "Run code formatter and code-fixing linter." skip_install = true -deps = ["ruff==0.11.13"] +deps = ["pre-commit"] commands = [ - ["ruff", "format", "{posargs:.}"], + ["pre-commit", "run", "--all-files", "--show-diff-on-failure", { replace = "posargs", extend = true }] ] [tool.tox.env.format_check] description = "Check that code is correctly formatted by ruff." skip_install = true deps = ["ruff==0.11.13"] -commands = [ - ["ruff", "format", "--check", "{posargs:.}"], -] [tool.tox.env.lint] description = "Run code linter and formatter (no fixes)." @@ -232,6 +230,7 @@ skip_install = true deps = ["ruff==0.11.13"] commands = [ ["ruff", "check", "{posargs:.}"], + ["ruff", "format", "{posargs:.}"], ] [tool.uv-dynamic-versioning]