Skip to content

Commit e11ed8b

Browse files
Karol Lateckicyb70289
Karol Latecki
authored andcommitted
scripts/ci: add markdown linter check
Check markdown linting each time we run the test to avoid already fixed styling issues. Change-Id: I34dca3217e5119e6cb71c1f4512beb0c40c50840 Signed-off-by: Karol Latecki <[email protected]> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk-csi/+/7308 Reviewed-by: Antti Kervinen <[email protected]> Reviewed-by: Yibo Cai <[email protected]> Reviewed-by: Pawel Piatek <[email protected]> Reviewed-by: Jaroslaw Chachulski <[email protected]> Reviewed-by: Krzysztof Karas <[email protected]> Reviewed-by: Kamil Godzwon <[email protected]> Tested-by: SPDK CI Jenkins <[email protected]>
1 parent d2606da commit e11ed8b

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ spdkcsi:
4545
@CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=linux go build -buildvcs=false -o $(OUT_DIR)/spdkcsi ./cmd/
4646

4747
# static code check, text lint
48-
lint: golangci yamllint shellcheck
48+
lint: golangci yamllint shellcheck mdl
4949

5050
.PHONY: golangci
5151
golangci: $(GOLANGCI_BIN)
@@ -76,6 +76,16 @@ shellcheck:
7676
echo shellcheck not installed, skip test; \
7777
fi
7878

79+
.PHONY: mdl
80+
mdl:
81+
@echo === running mdl
82+
@if hash mdl 2> /dev/null; then \
83+
find ./ -name "*.md" | xargs readlink -f | xargs mdl --style scripts/ci/mdl_rules.rb; \
84+
else \
85+
echo Markdown linter not found, please install; \
86+
false ; \
87+
fi
88+
7989
# tests
8090
test: mod-check unit-test
8191

scripts/ci/common.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ function install_packages_ubuntu() {
106106
systemctl start docker
107107
# install static check tools only on x86 agent
108108
if [ "$(arch)" == x86_64 ]; then
109-
apt-get install -y python3-pip
109+
apt-get install -y python3-pip ruby
110110
pip3 install yamllint==1.23.0 shellcheck-py==0.7.1.1
111111
fi
112+
gem install mdl -v 0.12.0
112113
}
113114

114115
function install_packages_fedora() {
@@ -119,7 +120,8 @@ function install_packages_fedora() {
119120
conntrack \
120121
bind-utils \
121122
socat \
122-
wget
123+
wget \
124+
ruby
123125
if ! hash docker &> /dev/null; then
124126
dnf remove -y docker*
125127
dnf install -y dnf-plugins-core
@@ -132,9 +134,10 @@ function install_packages_fedora() {
132134

133135
# install static check tools only on x86 agent
134136
if [ "$(arch)" == x86_64 ]; then
135-
dnf install -y python3-pip
137+
dnf install -y python3-pip ruby
136138
pip3 install yamllint==1.23.0 shellcheck-py==0.7.1.1
137139
fi
140+
gem install mdl -v 0.12.0
138141
}
139142

140143
function install_golang() {

scripts/ci/mdl_rules.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
all
2+
rule 'MD013', :line_length => 120
3+
rule 'MD029', :style => "ordered"
4+
exclude_rule 'MD031'

0 commit comments

Comments
 (0)