Skip to content

Commit 456b1d5

Browse files
committed
Replace markdownlint with mdformat
Markdownlint does not offer an automatic way to apply its formatting rules, so we have decided to replace it with a tool that does allow us to do so. Mdformat's formatting rules are listed at https://mdformat.readthedocs.io/en/stable/users/style.html Signed-off-by: Patrick Roy <[email protected]>
1 parent b56d201 commit 456b1d5

File tree

7 files changed

+761
-481
lines changed

7 files changed

+761
-481
lines changed

.mdformat.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
wrap = 80
2+
# Defaults from https://mdformat.readthedocs.io/en/stable/users/configuration_file.html
3+
number = false
4+
end_of_line = "lf"

.mdlrc

-1
This file was deleted.

tests/host_tools/mdl_style.rb

-16
This file was deleted.

tests/integration_tests/style/test_markdown.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,18 @@ def test_markdown_style():
1717
# Assert if somehow no markdown files were found.
1818
assert len(md_files) != 0
1919

20+
needs_format = False
21+
2022
# Run commands
21-
cmd = "mdl -c ../.mdlrc "
22-
for fname in md_files:
23-
cmd += fname + " "
24-
_, output, _ = utils.run_cmd(cmd)
25-
assert output == ""
23+
for md_file in md_files:
24+
rc, output, _ = utils.run_cmd(
25+
f"bash -c 'diff -u --color {md_file} <(mdformat - < {md_file})'",
26+
ignore_return_code=True,
27+
)
28+
if rc != 0:
29+
print(output)
30+
needs_format = True
31+
32+
assert (
33+
not needs_format
34+
), "Some markdown files need formatting. Either run `mdformat .` in the repository root, or apply the above diffs manually."

tools/devctr/Dockerfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ RUN apt-get update \
7979
screen tmux \
8080
tzdata \
8181
tini \
82-
# for mdl
83-
ruby \
8482
# for cpu-template-helper
8583
# TODO: Remove `dmidecode` after the end of kernel 4.14 support.
8684
# https://github.com/firecracker-microvm/firecracker/issues/3677
@@ -94,8 +92,7 @@ RUN apt-get update \
9492
# for debugging
9593
gdb strace \
9694
&& rm -rf /var/lib/apt/lists/* \
97-
&& pip3 install --upgrade pip poetry \
98-
&& gem install mdl
95+
&& pip3 install --upgrade pip poetry
9996

10097

10198
COPY tools/devctr /tmp/poetry

tools/devctr/poetry.lock

+738-455
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/devctr/pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ click = "8.1.3"
1212
gitlint = "^0.19.1"
1313
ipython = "^8.15.0"
1414
isort = "^5.12.0"
15+
mdformat = "^0.7.17"
16+
mdformat-gfm = "^0.3.5"
17+
mdformat-footnote = "^0.1.1"
18+
mdformat-frontmatter = "^2.0.8"
1519
# numpy >1.25.0,<=1.25.2 trigger an illegal instruction on AL2 4.14 on c7g.metal instances, due to these instances
1620
# not advertising SVE support. See https://github.com/numpy/numpy/issues/24028
1721
numpy = "1.24.3"

0 commit comments

Comments
 (0)