Skip to content
代码片段 群组 项目
未验证 提交 750ee5f1 编辑于 作者: Marcel Amirault's avatar Marcel Amirault 提交者: GitLab
浏览文件

Output count of linted docs in vale

上级 fa82da9e
No related branches found
No related tags found
无相关合并请求
...@@ -5,13 +5,10 @@ ...@@ -5,13 +5,10 @@
{{- $e := 0 -}} {{- $e := 0 -}}
{{- $w := 0 -}} {{- $w := 0 -}}
{{- $s := 0 -}} {{- $s := 0 -}}
{{- $f := 0 -}}
{{- /* Range over the linted files */ -}} {{- /* Range over the linted files */ -}}
{{- range .Files}} {{- range .Files}}
{{- $f = add1 $f -}}
{{- $path := .Path | underline -}} {{- $path := .Path | underline -}}
{{- /* Range over the file's alerts */ -}} {{- /* Range over the file's alerts */ -}}
...@@ -48,4 +45,4 @@ ...@@ -48,4 +45,4 @@
{{end -}} {{end -}}
{{end -}} {{end -}}
{{- $e}} {{"errors" | red}}, {{$w}} {{"warnings" | yellow}}, and {{$s}} {{"suggestions" | blue}} found. {{- $e}} {{"errors" | red}}, {{$w}} {{"warnings" | yellow}}, and {{$s}} {{"suggestions" | blue}} found in {{.LintedTotal}} {{.LintedTotal | int | plural "file" "files"}}.
...@@ -150,6 +150,7 @@ fi ...@@ -150,6 +150,7 @@ fi
if [ -n "$1" ] if [ -n "$1" ]
then then
MD_DOC_PATH="$@" MD_DOC_PATH="$@"
MD_DOC_PATH_VALE="$@"
# shellcheck disable=2059 # shellcheck disable=2059
printf "${COLOR_GREEN}INFO: List of files specified on command line. Running Markdownlint and Vale for only those files...${COLOR_RESET}\n" printf "${COLOR_GREEN}INFO: List of files specified on command line. Running Markdownlint and Vale for only those files...${COLOR_RESET}\n"
elif [ -n "${CI_MERGE_REQUEST_IID}" ] elif [ -n "${CI_MERGE_REQUEST_IID}" ]
...@@ -164,10 +165,12 @@ then ...@@ -164,10 +165,12 @@ then
if grep -E "\.vale|\.markdownlint|lint-doc\.sh|docs\.gitlab-ci\.yml" < $DOC_CHANGES_FILE if grep -E "\.vale|\.markdownlint|lint-doc\.sh|docs\.gitlab-ci\.yml" < $DOC_CHANGES_FILE
then then
MD_DOC_PATH=${MD_DOC_PATH:-'doc/{*,**/*}.md'} MD_DOC_PATH=${MD_DOC_PATH:-'doc/{*,**/*}.md'}
MD_DOC_PATH_VALE=${MD_DOC_PATH_VALE:-'doc/'}
# shellcheck disable=2059 # shellcheck disable=2059
printf "${COLOR_GREEN}INFO: Vale, Markdownlint, lint-doc.sh, or pipeline configuration changed. Testing all files.${COLOR_RESET}\n" printf "${COLOR_GREEN}INFO: Vale, Markdownlint, lint-doc.sh, or pipeline configuration changed. Testing all files.${COLOR_RESET}\n"
else else
MD_DOC_PATH=$(cat $DOC_CHANGES_FILE) MD_DOC_PATH=$(cat $DOC_CHANGES_FILE)
MD_DOC_PATH_VALE=$(cat $DOC_CHANGES_FILE)
if [ -n "${MD_DOC_PATH}" ] if [ -n "${MD_DOC_PATH}" ]
then then
# shellcheck disable=2059 # shellcheck disable=2059
...@@ -177,6 +180,7 @@ then ...@@ -177,6 +180,7 @@ then
rm $DOC_CHANGES_FILE rm $DOC_CHANGES_FILE
else else
MD_DOC_PATH=${MD_DOC_PATH:-'doc/{*,**/*}.md'} MD_DOC_PATH=${MD_DOC_PATH:-'doc/{*,**/*}.md'}
MD_DOC_PATH_VALE=${MD_DOC_PATH_VALE:-'doc/'}
# shellcheck disable=2059 # shellcheck disable=2059
printf "${COLOR_GREEN}INFO: No merge request pipeline detected. Running Markdownlint and Vale on all files...${COLOR_RESET}\n" printf "${COLOR_GREEN}INFO: No merge request pipeline detected. Running Markdownlint and Vale on all files...${COLOR_RESET}\n"
fi fi
...@@ -235,7 +239,7 @@ fi ...@@ -235,7 +239,7 @@ fi
# shellcheck disable=2059 # shellcheck disable=2059
printf "${COLOR_GREEN}INFO: Looking for Vale to lint prose, either installed locally or available in documentation linting image...${COLOR_RESET}\n" printf "${COLOR_GREEN}INFO: Looking for Vale to lint prose, either installed locally or available in documentation linting image...${COLOR_RESET}\n"
run_locally_or_in_container 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl" "${MD_DOC_PATH}" run_locally_or_in_container 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl" "${MD_DOC_PATH_VALE}"
if [ "$ERRORCODE" -ne 0 ] if [ "$ERRORCODE" -ne 0 ]
then then
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册