Skip to content

Commit dc427ce

Browse files
docs: Format Python code blocks in Markdown files with native Ruff support
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent da3eb7d commit dc427ce

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ repos:
4343
hooks:
4444
- id: doccmd
4545
name: Ruff format docs
46+
language: python
4647
alias: ruff-format-docs
4748
args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff format", "docs/"]
4849
additional_dependencies:
49-
- ruff==0.14.8
50+
- ruff==0.15.0
5051
- id: doccmd
5152
name: Ruff check fix docs
53+
language: python
5254
alias: ruff-check-fix-docs
5355
args: ["--language", "python", "--no-pad-file", "--no-pad-groups", "--command", "ruff check --fix", "docs/"]
5456
additional_dependencies:
55-
- ruff==0.14.8
57+
- ruff==0.15.0

docs/examples.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ def upload_to_s3(bucket, key, data):
239239
@backoff.on_exception(
240240
backoff.expo,
241241
ClientError,
242-
giveup=lambda e: e.response["Error"]["Code"]
243-
!= "ProvisionedThroughputExceededException",
242+
giveup=lambda e: (
243+
e.response["Error"]["Code"] != "ProvisionedThroughputExceededException"
244+
),
244245
max_time=30,
245246
)
246247
def write_to_dynamodb(table_name, item):

docs/user-guide/event-handlers.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,13 @@ logger = logging.getLogger(__name__)
178178

179179
def structured_log_backoff(details):
180180
logger.warning(
181-
json.dumps(
182-
{
183-
"event": "retry",
184-
"function": details["target"].__name__,
185-
"tries": details["tries"],
186-
"wait": details["wait"],
187-
"elapsed": details["elapsed"],
188-
}
189-
)
181+
json.dumps({
182+
"event": "retry",
183+
"function": details["target"].__name__,
184+
"tries": details["tries"],
185+
"wait": details["wait"],
186+
"elapsed": details["elapsed"],
187+
})
190188
)
191189

192190

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ docs = [
4949
"zensical==0.0.20",
5050
]
5151
lint = [
52-
"ruff>=0.12.9",
52+
"ruff>=0.15.0",
5353
]
5454
test = [
5555
"coverage>=7.2.7",
@@ -124,7 +124,7 @@ description = "format code"
124124
dependency_groups = [ "lint" ]
125125
commands = [
126126
[ "ruff", "check", "--fix", { replace = "posargs", default = [ "backoff", "tests" ], extend = true } ],
127-
# [ "ruff", "format", { replace = "posargs", default = [ "backoff", "tests" ], extend = true } ],
127+
[ "ruff", "format", { replace = "posargs", default = [ "backoff", "tests" ], extend = true } ],
128128
]
129129

130130
[tool.tox.env.lint]
@@ -177,7 +177,10 @@ package = [
177177
]
178178

179179
[tool.ruff]
180+
extend-include = ["docs/**/*.md"]
180181
line-length = 88
182+
preview = true
183+
required-version = ">=0.15"
181184

182185
[tool.ruff.format]
183186
docstring-code-format = true

0 commit comments

Comments
 (0)