Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: add local markdown linting to make check

Nick Craig-Wood85deea82e4ac
diff --git a/Makefile b/Makefile
index 8ed067f66..3c5981890 100644
--- a/Makefile
+++ b/Makefile
@@ -100,6 +100,7 @@ compiletest:
check: rclone
@echo "-- START CODE QUALITY REPORT -------------------------------"
@golangci-lint run $(LINTTAGS) ./...
+ @bin/markdown-lint
@echo "-- END CODE QUALITY REPORT ---------------------------------"
# Get the build dependencies
diff --git a/bin/markdown-lint b/bin/markdown-lint
new file mode 100755
index 000000000..960ee4798
--- /dev/null
+++ b/bin/markdown-lint
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# Run markdown linting locally
+set -e
+
+# Workflow
+build=.github/workflows/build.yml
+
+# Globs read from from $build
+globs=$(awk '/- name: Check Markdown format/{f=1;next} f && /globs:/{f=2;next} f==2 && NF{if($1=="-"){exit} print $0}' $build)
+
+if [ -z "$globs" ]; then
+ echo "Error: No globs found in Check Markdown step in $build" >&2
+ exit 1
+fi
+
+docker run -v $PWD:/workdir --user $(id -u):$(id -g) davidanson/markdownlint-cli2 $globs