1
0
mirror of https://github.com/docker/docs.git synced 2026-10-23 18:09:02 +03:00
Files
docs/scripts/lint.sh
David Karlsson 83cfca0358 chore: use shared Vale rules
Fetch the Docker style package from docs-toolkit and retain only the local vocabulary and repository-specific configuration. Resolve existing canonical-name violations exposed by the shared package.
2026-09-11 12:37:25 +02:00

42 lines
978 B
Bash
Executable File

#!/bin/bash
# Run rumdl and Vale on specific Markdown files.
# Usage: scripts/lint.sh <markdown-file> [markdown-file...]
#
# Scoped output — no repo-wide noise. For full repo validation, use:
# docker buildx bake validate
set -uo pipefail
if [ $# -eq 0 ]; then
echo "Usage: $0 <markdown-file> [markdown-file...]" >&2
exit 1
fi
for file in "$@"; do
if [[ "$file" != *.md ]]; then
echo "Error: scripts/lint.sh only accepts Markdown files: $file" >&2
exit 2
fi
done
repo_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
exit_code=0
echo "=== rumdl ==="
if ! npx --no-install rumdl check "$@" 2>&1; then
exit_code=1
fi
echo ""
echo "=== vale ==="
if ! vale --no-global --config="$repo_root/.vale.ini" sync 2>&1; then
exit_code=1
elif ! vale --no-global --config="$repo_root/.vale.ini" "$@" 2>&1; then
exit_code=1
fi
echo ""
echo "Review Vale warnings and suggestions on changed lines; they don't affect the exit status."
exit $exit_code