From dc427ced532af2a1e73690abbd94a820abb934c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Sat, 7 Feb 2026 11:24:04 -0600 Subject: [PATCH] docs: Format Python code blocks in Markdown files with native Ruff support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Edgar Ramírez Mondragón --- .pre-commit-config.yaml | 6 ++++-- docs/examples.md | 5 +++-- docs/user-guide/event-handlers.md | 16 +++++++--------- pyproject.toml | 7 +++++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ed85932..567557c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,13 +43,15 @@ repos: hooks: - id: doccmd name: Ruff format docs + language: python alias: ruff-format-docs args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff format", "docs/"] additional_dependencies: - - ruff==0.14.8 + - ruff==0.15.0 - id: doccmd name: Ruff check fix docs + language: python alias: ruff-check-fix-docs args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff check --fix", "docs/"] additional_dependencies: - - ruff==0.14.8 + - ruff==0.15.0 diff --git a/docs/examples.md b/docs/examples.md index a7f31a7..db7283a 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -239,8 +239,9 @@ def upload_to_s3(bucket, key, data): @backoff.on_exception( backoff.expo, ClientError, - giveup=lambda e: e.response["Error"]["Code"] - != "ProvisionedThroughputExceededException", + giveup=lambda e: ( + e.response["Error"]["Code"] != "ProvisionedThroughputExceededException" + ), max_time=30, ) def write_to_dynamodb(table_name, item): diff --git a/docs/user-guide/event-handlers.md b/docs/user-guide/event-handlers.md index e5ba694..46d46b6 100644 --- a/docs/user-guide/event-handlers.md +++ b/docs/user-guide/event-handlers.md @@ -178,15 +178,13 @@ logger = logging.getLogger(__name__) def structured_log_backoff(details): logger.warning( - json.dumps( - { - "event": "retry", - "function": details["target"].__name__, - "tries": details["tries"], - "wait": details["wait"], - "elapsed": details["elapsed"], - } - ) + json.dumps({ + "event": "retry", + "function": details["target"].__name__, + "tries": details["tries"], + "wait": details["wait"], + "elapsed": details["elapsed"], + }) ) diff --git a/pyproject.toml b/pyproject.toml index 5bf37a9..1d75e9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ docs = [ "zensical==0.0.20", ] lint = [ - "ruff>=0.12.9", + "ruff>=0.15.0", ] test = [ "coverage>=7.2.7", @@ -124,7 +124,7 @@ description = "format code" dependency_groups = [ "lint" ] commands = [ [ "ruff", "check", "--fix", { replace = "posargs", default = [ "backoff", "tests" ], extend = true } ], - # [ "ruff", "format", { replace = "posargs", default = [ "backoff", "tests" ], extend = true } ], + [ "ruff", "format", { replace = "posargs", default = [ "backoff", "tests" ], extend = true } ], ] [tool.tox.env.lint] @@ -177,7 +177,10 @@ package = [ ] [tool.ruff] +extend-include = ["docs/**/*.md"] line-length = 88 +preview = true +required-version = ">=0.15" [tool.ruff.format] docstring-code-format = true