health-check: Add version check for mdformat

On glinux people may have set up the google internal mdformat
tool, which is different from the open source mdformat tool.

BUG=b:236962138
TEST=./tools/health-check --all markdown_format
with PATH updated to use both versions

Change-Id: Ia6b783c52195f2edd33eb836333b28f257be8a32
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894236
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
Dennis Kempin 2022-09-13 17:01:28 +00:00 committed by crosvm LUCI
parent e27dde0caa
commit 7150e63ee3

View file

@ -61,6 +61,11 @@ def check_crlf_line_endings(_: CheckContext):
def check_markdown_format(context: CheckContext):
"Runs mdformat on all markdown files."
if "blaze" in mdformat("--version").stdout():
raise Exception(
"You are using google's mdformat. "
+ "Please update your PATH to ensure the pip installed mdformat is available."
)
parallel(
*mdformat("--wrap 100", "--check" if not context.fix else "").foreach(
context.modified_files