diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /scripts/lint-doc.sh | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'scripts/lint-doc.sh')
-rwxr-xr-x | scripts/lint-doc.sh | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 9ae6ce400da..23e7cb6c455 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -18,6 +18,21 @@ then ((ERRORCODE++)) fi +# Test for non-standard spaces (NBSP, NNBSP) in documentation. +echo '=> Checking for non-standard spaces...' +echo +grep --extended-regexp --binary-file=without-match --recursive '[ ]' doc/ >/dev/null 2>&1 +if [ $? -eq 0 ] +then + echo '✖ ERROR: Non-standard spaces (NBSP, NNBSP) should not be used in documentation. + https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#spaces-between-words + Replace with standard spaces:' >&2 + # Find the spaces, then add color codes with sed to highlight each NBSP or NNBSP in the output. + grep --extended-regexp --binary-file=without-match --recursive --color=auto '[ ]' doc \ + | sed -e ''/ /s//`printf "\033[0;101m \033[0m"`/'' -e ''/ /s//`printf "\033[0;101m \033[0m"`/'' + ((ERRORCODE++)) +fi + # Ensure that the CHANGELOG.md does not contain duplicate versions DUPLICATE_CHANGELOG_VERSIONS=$(grep --extended-regexp '^## .+' CHANGELOG.md | sed -E 's| \(.+\)||' | sort -r | uniq -d) echo '=> Checking for CHANGELOG.md duplicate entries...' @@ -65,10 +80,16 @@ then echo "Merge request pipeline (detached) detected. Testing all files." else MERGE_BASE=$(git merge-base ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}) - MD_DOC_PATH=$(git diff --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" 'doc/*.md') - if [ -n "${MD_DOC_PATH}" ] + if git diff --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" | grep -E "\.vale|\.markdownlint|lint-doc\.sh" then - echo -e "Merged results pipeline detected. Testing only the following files:\n${MD_DOC_PATH}" + MD_DOC_PATH=${MD_DOC_PATH:-doc} + echo "Vale, Markdownlint, or lint-doc.sh configuration changed. Testing all files." + else + MD_DOC_PATH=$(git diff --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" 'doc/*.md') + if [ -n "${MD_DOC_PATH}" ] + then + echo -e "Merged results pipeline detected. Testing only the following files:\n${MD_DOC_PATH}" + fi fi fi |