Skip to content

Commit 1a6dc99

Browse files
committed
fix: Add missing (new) check_only argument to blacken-docs
Issue-22: #22
1 parent bc6191d commit 1a6dc99

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: src/duty/callables/blacken_docs.py

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def run(
2424
magic_trailing_comma: bool = True,
2525
python_cell_magics: set[str] | None = None,
2626
preview: bool = False,
27+
check_only: bool = False,
2728
) -> int:
2829
"""Run `blacken-docs`.
2930
@@ -44,6 +45,8 @@ def run(
4445
Useful for formatting cells with custom python magics.
4546
preview: Enable potentially disruptive style changes that may be added
4647
to Black's main functionality in the next major release.
48+
check_only: Don't modify files but indicate when changes are necessary
49+
with a message and non-zero return code.
4750
4851
Returns:
4952
Success/failure.
@@ -80,5 +83,6 @@ def run(
8083
black_mode,
8184
skip_errors=skip_errors,
8285
rst_literal_blocks=rst_literal_blocks,
86+
check_only=check_only,
8387
)
8488
return retv

Diff for: src/duty/tools/_blacken_docs.py

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def __init__(
2929
magic_trailing_comma: bool = True,
3030
python_cell_magics: set[str] | None = None,
3131
preview: bool = False,
32+
check_only: bool = False,
3233
) -> None:
3334
"""Run `blacken-docs`.
3435
@@ -49,6 +50,8 @@ def __init__(
4950
Useful for formatting cells with custom python magics.
5051
preview: Enable potentially disruptive style changes that may be added
5152
to Black's main functionality in the next major release.
53+
check_only: Don't modify files but indicate when changes are necessary
54+
with a message and non-zero return code.
5255
5356
Returns:
5457
Success/failure.
@@ -77,6 +80,7 @@ def __call__(self) -> int:
7780
preview = self.py_args["preview"]
7881
skip_errors = self.py_args["skip_errors"]
7982
rst_literal_blocks = self.py_args["rst_literal_blocks"]
83+
check_only = self.py_args["check_only"]
8084

8185
# Build filepaths.
8286
exts = ("md", "py") if exts is None else tuple(ext.lstrip(".") for ext in exts)
@@ -111,5 +115,6 @@ def __call__(self) -> int:
111115
black_mode,
112116
skip_errors=skip_errors,
113117
rst_literal_blocks=rst_literal_blocks,
118+
check_only=check_only,
114119
)
115120
return retv

0 commit comments

Comments
 (0)