mirror of
https://github.com/linux-msm/qdl.git
synced 2026-10-07 06:29:17 -07:00
The markdown lint wrapper names README.md and docs/ explicitly, so documents like AGENTS.md, CONTRIBUTING.md and RELEASING.md have never been linted and accumulated findings silently. Derive the file list from git ls-files instead, excluding CHANGELOG.md - generated by the release process, where long release-note URLs and per-release repeated section headers are part of the format - and CLAUDE.md, a symlink to the already-linted AGENTS.md. New documents are picked up automatically. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
35 lines
902 B
Bash
Executable File
35 lines
902 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"
|
|
|
|
# Lint every markdown file tracked in git, except:
|
|
# - CHANGELOG.md: generated by the release process; long release-note
|
|
# URLs and per-release repeated section headers are part of the format
|
|
# - CLAUDE.md: a symlink to AGENTS.md, which is already linted
|
|
mapfile -t MARKDOWN_FILES < <(git ls-files '*.md' ':!CHANGELOG.md' ':!CLAUDE.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
|