Enable markdown-link-check (#541)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
Bogdan Drutu 2020-04-02 08:04:14 -07:00 committed by GitHub
parent b01b9abd17
commit 264bdecf0f
5 changed files with 53 additions and 31 deletions

View File

@ -7,24 +7,32 @@ jobs:
- image: circleci/golang:1.12
steps:
- checkout
- run:
name: Misspell Install
command: make install-misspell
- run:
name: Misspell check
command: make precommit
command: make misspell
markdownlint:
docker:
- image: circleci/ruby:latest
- image: node:13
steps:
- checkout
- run:
name: Install markdownlint
command: gem install mdl
name: Install Tools
command: |
make install-markdown-lint
make install-markdown-link-check
- run:
name: Check markdownlint
command: mdl -c .mdlrc .
name: Run Tools
command: |
make markdown-lint
make enforce-markdown-link-check
workflows:
version: 2
build:
check-errors:
jobs:
- misspell
- markdownlint

9
.markdownlint.yaml Normal file
View File

@ -0,0 +1,9 @@
{
"default": true,
"MD024": { "allow_different_nesting": true },
"MD029": { "style": "ordered" },
"ul-style": false, # MD004
"line-length": false, # MD013
"no-inline-html": false, # MD033
"fenced-code-language": false # MD040
}

1
.mdlrc
View File

@ -1 +0,0 @@
style ".mdlstyle.rb"

View File

@ -1,19 +0,0 @@
all
# Multiple headings with the same content allowed for sibling headings
rule 'MD024', :allow_different_nesting => true
# Ordered lists should have increasing prefixes
rule 'MD029', :style => :ordered
# Ignore unordered list style
exclude_rule 'MD004'
# Ignore line length
exclude_rule 'MD013'
# Inline HTML
exclude_rule 'MD033'
# Fenced code blocks should have a language specified
exclude_rule 'MD040'

View File

@ -3,12 +3,10 @@ ALL_DOC := $(shell find . -name '*.md' -type f | sort)
TOOLS_DIR := ./.tools
MISSPELL_BINARY=$(TOOLS_DIR)/misspell
.PHONY: precommit
precommit: install-misspell misspell
MARKDOWN_LINK_CHECK=markdown-link-check
.PHONY: install-misspell
install-misspell: go.mod go.sum internal/tools.go
install-misspell:
go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell
.PHONY: misspell
@ -18,3 +16,30 @@ misspell:
.PHONY: misspell-correction
misspell-correction:
$(MISSPELL_BINARY) -w $(ALL_DOCS)
.PHONY: install-markdown-link-check
install-markdown-link-check:
npm install -g $(MARKDOWN_LINK_CHECK)
.PHONY: markdown-link-check
markdown-link-check:
find . -name \*.md -exec $(MARKDOWN_LINK_CHECK) {} \;
.PHONY: enforce-markdown-link-check
enforce-markdown-link-check:
@LINKCHECKOUT=`find . -name \*.md -exec $(MARKDOWN_LINK_CHECK) {} 2>&1 >/dev/null \;`; \
if [ "$$LINKCHECKOUT" ]; then \
echo "$(MARKDOWN_LINK_CHECK) FAILED => errors:\n"; \
echo "Run 'make $(MARKDOWN_LINK_CHECK)' to see the errors" \
exit 1; \
else \
echo "Check markdown links finished successfully"; \
fi
.PHONY: install-markdown-lint
install-markdown-lint:
npm install -g markdownlint-cli
.PHONY: markdown-lint
markdown-lint:
markdownlint -c .markdownlint.yaml '**/*.md'