diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 12:07:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 12:07:48 +0000 |
commit | 5a6b36b60502c50ab59c0bc3c345793b70a3d548 (patch) | |
tree | 7cf2effbd48359b44970f8f345cfa12ce6843dfd /scripts | |
parent | a76d34e6716aa8267111ecdcd21416e9dec3a08d (diff) | |
download | gitlab-ce-5a6b36b60502c50ab59c0bc3c345793b70a3d548.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/lint-doc.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 69c7a56c34f..5477002eb43 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -48,5 +48,39 @@ then exit 1 fi +MD_DOC_PATH=${MD_DOC_PATH:-doc/**/*.md} + +function run_locally_or_in_docker() { + local cmd=$1 + local args=$2 + + if hash ${cmd} 2>/dev/null + then + $cmd $args + elif hash docker 2>/dev/null + then + docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs:lint ${cmd} ${args} + else + echo + echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or Docker to proceed." >&2 + echo + exit 1 + fi + + if [ $? -ne 0 ] + then + echo + echo " ✖ ERROR: '${cmd}' failed with errors." >&2 + echo + exit 1 + fi +} + +echo '=> Linting markdown style...' +run_locally_or_in_docker 'markdownlint' "--config .markdownlint.json ${MD_DOC_PATH}" + +echo '=> Linting prose...' +run_locally_or_in_docker 'vale' "--minAlertLevel error --ignore-syntax ${MD_DOC_PATH}" + echo "✔ Linting passed" exit 0 |