Skip to content

Commit ab5e928

Browse files
authored
Update pre-commit hooks (#23)
* Update pre-commit filters * Fix pre-commit issues
1 parent c004cab commit ab5e928

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-added-large-files
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- id: mixed-line-ending
99
- repo: "https://github.com/ambv/black"
10-
rev: 23.1.0
10+
rev: 25.1.0
1111
hooks:
1212
- id: black-jupyter
1313
language_version: python3
1414
- repo: https://github.com/charliermarsh/ruff-pre-commit
15-
rev: "v0.0.259"
15+
rev: "v0.11.2"
1616
hooks:
1717
- id: ruff
1818
args: ["--fix"]
1919
- repo: https://github.com/pre-commit/mirrors-mypy
20-
rev: "v1.1.1"
20+
rev: "v1.15.0"
2121
hooks:
2222
- id: mypy
2323
additional_dependencies: ["types-PyYAML", "types-requests", "types-setuptools"]

markdown_code_runner.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
echo "Hello, world!"
3636
```
3737
Which will similarly print the output of the code block between next to the output markers.
38+
3839
"""
3940

4041
from __future__ import annotations
@@ -134,11 +135,12 @@ def execute_code(
134135
exec(full_code, context) # noqa: S102
135136
output = string.getvalue().split("\n")
136137
elif language == "bash":
137-
result = subprocess.run(
138+
result = subprocess.run( # noqa: S602
138139
full_code,
139140
capture_output=True,
140141
text=True,
141142
shell=True,
143+
check=False,
142144
)
143145
output = result.stdout.split("\n")
144146
else:
@@ -304,6 +306,7 @@ def process_markdown(content: list[str], *, verbose: bool = False) -> list[str]:
304306
-------
305307
list[str]
306308
A modified list of Markdown-formatted strings with code block output inserted.
309+
307310
"""
308311
assert isinstance(content, list), "Input must be a list"
309312
state = ProcessingState()

tests/test_app.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test the markdown_code_runner app."""
2+
23
from __future__ import annotations
34

45
import argparse
@@ -748,10 +749,6 @@ def test_patterns() -> None:
748749
),
749750
("```python markdown-code-runner", {"language": "python"}),
750751
("This is a regular text line", {}),
751-
(
752-
"```javascript markdown-code-runner filename=test.js",
753-
{"language": "javascript", "filename": "test.js"},
754-
),
755752
(
756753
"```python markdown-code-runner arg=test.js",
757754
{"language": "python", "arg": "test.js"},
@@ -760,10 +757,6 @@ def test_patterns() -> None:
760757
"```javascript markdown-code-runner filename=test.js arg2=1",
761758
{"language": "javascript", "filename": "test.js", "arg2": "1"},
762759
),
763-
(
764-
"```python markdown-code-runner",
765-
{"language": "python"},
766-
),
767760
(
768761
"```python markdown-code-runner arg1=value1 arg2=value2 arg3=value3",
769762
{

0 commit comments

Comments
 (0)