2020-01-05 17:59:13 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#
|
2021-11-14 12:28:52 -08:00
|
|
|
# Copyright (C) 2020-2021 kcgen <kcgen@users.noreply.github.com>
|
2020-01-05 17:59:13 -08:00
|
|
|
#
|
2022-05-27 12:03:36 -07:00
|
|
|
# This is a convenient helper to run mdl (markdownlint) on the
|
|
|
|
# *.md files in the repo, except for those inside directories
|
|
|
|
# that are likely to hold 3rd party documentation.
|
|
|
|
#
|
|
|
|
# You can pass additional mdl arguments to this script itself, e.g.:
|
2020-01-05 17:59:13 -08:00
|
|
|
#
|
|
|
|
# ./verify-markdown.sh --verbose --json
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
list_markdown_files () {
|
2022-05-27 12:03:36 -07:00
|
|
|
git ls-files -- \
|
|
|
|
'*.md' \
|
2023-09-10 16:09:30 +10:00
|
|
|
':!:.github/*.md' \
|
2023-09-08 11:20:57 +10:00
|
|
|
':!:.github/**/*.md' \
|
2022-05-27 12:03:36 -07:00
|
|
|
':!:src/libs/*.md' \
|
2022-11-09 11:24:03 -08:00
|
|
|
':!:src/hardware/reelmagic/docs/*.md' \
|
2023-09-21 22:07:42 +02:00
|
|
|
':!:contrib/resources/*.md' \
|
|
|
|
':!:contrib/resources/translations/*.md'
|
2020-01-05 17:59:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
main () {
|
2020-03-17 07:13:23 -07:00
|
|
|
repo_root="$(git rev-parse --show-toplevel)"
|
2020-01-05 17:59:13 -08:00
|
|
|
mdl --version
|
|
|
|
echo "Checking files:"
|
|
|
|
list_markdown_files
|
2020-03-17 07:13:23 -07:00
|
|
|
list_markdown_files | xargs -L 1000 mdl --style "$repo_root/.mdl-styles" "$@"
|
2020-01-05 17:59:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
>&2 main "$@"
|