From dc11fe14f6fa859773276f7492e326e49e47e0ba Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Sat, 28 Dec 2024 13:35:27 +0000 Subject: [PATCH] pre-commit: Migrate to ruff Signed-off-by: Stephen Finucane --- .pre-commit-config.yaml | 15 ++++----------- pyproject.toml | 19 ++++--------------- sphinx_click/ext.py | 2 +- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9fcf7f..95ef88d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,6 @@ # See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks --- -default_language_version: - # force all unspecified python hooks to run python3 - python: python3 repos: - - repo: https://github.com/ambv/black - rev: 24.10.0 - hooks: - - id: black - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: @@ -23,10 +15,11 @@ repos: - id: check-yaml files: .*\.(yaml|yml)$ - id: check-added-large-files - - repo: https://github.com/pycqa/flake8 - rev: 7.1.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.4 hooks: - - id: flake8 + - id: ruff + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.14.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 9123a21..38dcb62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,5 @@ -[tool.black] +[tool.ruff] line-length = 88 -target-version = ['py37'] -skip-string-normalization = true -exclude = ''' -( - /( - \.eggs - | \.git - | \.tox - | \.venv - | build - | dist - ) -) -''' + +[tool.ruff.format] +quote-style = "preserve" diff --git a/sphinx_click/ext.py b/sphinx_click/ext.py index d6f10e6..9876069 100644 --- a/sphinx_click/ext.py +++ b/sphinx_click/ext.py @@ -239,7 +239,7 @@ def _format_arguments(ctx: click.Context) -> ty.Generator[str, None, None]: def _format_envvar( - param: ty.Union[click.core.Option, click.Argument] + param: ty.Union[click.core.Option, click.Argument], ) -> ty.Generator[str, None, None]: """Format the envvars of a `click.Option` or `click.Argument`.""" yield '.. envvar:: {}'.format(param.envvar)