From 821f1443f2966aa9d3de501925b32b58f8d6de4f Mon Sep 17 00:00:00 2001 From: Marcel Amirault <mamirault@gitlab.com> Date: Tue, 11 Feb 2025 20:37:09 +0000 Subject: [PATCH] Move the non-standard space job to vale If it's in vale, it can be used in more projects --- doc/.vale/gitlab_base/NonStandardSpaces.yml | 19 +++++++++++++++++++ scripts/lint-doc.sh | 16 ---------------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 doc/.vale/gitlab_base/NonStandardSpaces.yml diff --git a/doc/.vale/gitlab_base/NonStandardSpaces.yml b/doc/.vale/gitlab_base/NonStandardSpaces.yml new file mode 100644 index 000000000000..05b5939a2b73 --- /dev/null +++ b/doc/.vale/gitlab_base/NonStandardSpaces.yml @@ -0,0 +1,19 @@ +--- +# Warning: gitlab_base.NonStandardSpaces +# +# Use only standard spaces. Do not use: +# +# U+202F : NARROW NO-BREAK SPACE [NNBSP] +# U+00A0 : NO-BREAK SPACE [NBSP] +# U+200B : ZERO WIDTH SPACE [ZWSP] +# +# For a list of all options, see https://vale.sh/docs/topics/styles/ +extends: existence +message: "Use standard spaces only. Do not use no-break or zero width spaces." +vocab: false +level: error +ignorecase: true +link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#punctuation +scope: raw +raw: + - '[  ​]' diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 489775be7818..d13548bf869a 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -33,22 +33,6 @@ then ((ERRORCODE++)) fi -# Test for non-standard spaces (NBSP, NNBSP, ZWSP) in documentation. -# shellcheck disable=2059 -printf "${COLOR_GREEN}INFO: Checking for non-standard spaces...${COLOR_RESET}\n" -if grep --extended-regexp --binary-file=without-match --recursive '[  ​]' doc/ >/dev/null 2>&1; -then - # shellcheck disable=2059 - printf "${COLOR_RED}ERROR: Non-standard spaces (NBSP, NNBSP, ZWSP) should not be used in documentation!${COLOR_RESET}" - printf " https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#spaces-between-words\n" - printf "Replace with standard spaces:\n" >&2 - # Find the spaces, then add color codes with sed to highlight each NBSP or NNBSP in the output. - # shellcheck disable=SC1018 - 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) # shellcheck disable=2059 -- GitLab