Files
qdl/scripts/markdownlint_wrapper.sh
T
Igor Opaniuk 00f1b9bb0f markdown-lint: Add wrapper script and meson target
The markdown lint check previously only ran in CI via the
markdownlint-cli2 GitHub Action, which meant developers had no
straightforward way to reproduce the check locally before pushing. As a
result, contributors only discovered lint errors after opening a PR.

Introduce scripts/markdownlint_wrapper.sh that drives mdl on the same
set of files the CI workflow lints. mdl is shipped as a Debian/Ubuntu
package, so contributors can install it with 'sudo apt install mdl'
without pulling in a Node.js toolchain. Wire the wrapper up as a meson
run_target so it can be invoked with:

  meson compile markdown-lint -C build

Switch the markdown-lint workflow to install mdl from apt and invoke
the wrapper directly, making the script the single source of truth for
both local and CI runs. Document the usage in README under the
Contributing section.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
2026-05-04 21:25:07 -05:00

32 lines
665 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause
set -euo pipefail
ROOT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/../"
# Run consistently from the repo root regardless of where the script is called
cd "$ROOT_PATH"
# Files to lint. Keep this in sync with .github/workflows/markdown-lint.yml
MARKDOWN_FILES=("README.md")
run_lint() {
if ! command -v mdl >/dev/null 2>&1; then
echo "mdl not found." >&2
echo "Install it with: sudo apt install markdownlint (or 'gem install mdl')" >&2
exit 1
fi
mdl "${MARKDOWN_FILES[@]}"
}
usage() {
echo "Usage: $0 {check}"
exit 2
}
case "${1:-}" in
check) run_lint ;;
*) usage ;;
esac