Skip to content
代码片段 群组 项目
提交 7817afb8 编辑于 作者: Achilleas Pipinellis's avatar Achilleas Pipinellis
浏览文件

Add test for dashes in the docs filenames

The majority of the docs filenames use underscores instead of dashes.

- Dashes: 72 pages
- Underscores: 1027 pages

We have a similar test for directory names, this expands it to filenames
as well.
上级 ea0341fe
No related branches found
No related tags found
无相关合并请求
...@@ -90,11 +90,11 @@ fi ...@@ -90,11 +90,11 @@ fi
# Do not use dashes (-) in directory names, use underscores (_) instead. # Do not use dashes (-) in directory names, use underscores (_) instead.
# Number of directories with dashes as of 2021-09-17 # Number of directories with dashes as of 2021-09-17
NUMBER_DASHES=2 DIR_NUMBER_DASHES=2
FIND_DASHES=$(find doc -type d -name "*-*" | wc -l) DIR_FIND_DASHES=$(find doc -type d -name "*-*" | wc -l)
# shellcheck disable=2059 # shellcheck disable=2059
printf "${COLOR_GREEN}INFO: Checking for directory names containing dashes...${COLOR_RESET}\n" printf "${COLOR_GREEN}INFO: Checking for directory names containing dashes...${COLOR_RESET}\n"
if [ "${FIND_DASHES}" -ne $NUMBER_DASHES ] if [ "${DIR_FIND_DASHES}" -ne $DIR_NUMBER_DASHES ]
then then
# shellcheck disable=2059 # shellcheck disable=2059
printf "${COLOR_RED}ERROR: The number of directory names containing dashes has changed!${COLOR_RESET} Use underscores instead of dashes for the directory names.\n" >&2 printf "${COLOR_RED}ERROR: The number of directory names containing dashes has changed!${COLOR_RESET} Use underscores instead of dashes for the directory names.\n" >&2
...@@ -103,6 +103,21 @@ then ...@@ -103,6 +103,21 @@ then
((ERRORCODE++)) ((ERRORCODE++))
fi fi
# Do not use dashes (-) in filenames, use underscores (_) instead.
# Number of filenames with dashes as of 2024-03-29
FILE_NUMBER_DASHES=73
FILE_FIND_DASHES=$(find doc -type f -name "*-*.md" | wc -l)
# shellcheck disable=2059
printf "${COLOR_GREEN}INFO: Checking for filenames containing dashes...${COLOR_RESET}\n"
if [ "${FILE_FIND_DASHES}" -ne $FILE_NUMBER_DASHES ]
then
# shellcheck disable=2059
printf "${COLOR_RED}ERROR: The number of filenames containing dashes has changed!${COLOR_RESET} Use underscores instead of dashes for the filenames.\n" >&2
printf "If removing a file containing dashes, update the filename NUMBER_DASHES in lint-doc.sh.\n" >&2
printf "https://docs.gitlab.com/ee/development/documentation/site_architecture/folder_structure.html#work-with-directories-and-files\n"
((ERRORCODE++))
fi
# Do not use uppercase letters in directory and file names, use all lowercase instead. # Do not use uppercase letters in directory and file names, use all lowercase instead.
# (find always returns 0, so we use the grep hack https://serverfault.com/a/225827) # (find always returns 0, so we use the grep hack https://serverfault.com/a/225827)
FIND_UPPERCASE_DIRS=$(find doc -type d -name "*[[:upper:]]*") FIND_UPPERCASE_DIRS=$(find doc -type d -name "*[[:upper:]]*")
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册