Enable markdown-link-check (#541)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
b01b9abd17
commit
264bdecf0f
|
|
@ -7,24 +7,32 @@ jobs:
|
||||||
- image: circleci/golang:1.12
|
- image: circleci/golang:1.12
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Misspell Install
|
||||||
|
command: make install-misspell
|
||||||
- run:
|
- run:
|
||||||
name: Misspell check
|
name: Misspell check
|
||||||
command: make precommit
|
command: make misspell
|
||||||
|
|
||||||
markdownlint:
|
markdownlint:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/ruby:latest
|
- image: node:13
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
name: Install markdownlint
|
name: Install Tools
|
||||||
command: gem install mdl
|
command: |
|
||||||
|
make install-markdown-lint
|
||||||
|
make install-markdown-link-check
|
||||||
- run:
|
- run:
|
||||||
name: Check markdownlint
|
name: Run Tools
|
||||||
command: mdl -c .mdlrc .
|
command: |
|
||||||
|
make markdown-lint
|
||||||
|
make enforce-markdown-link-check
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build:
|
check-errors:
|
||||||
jobs:
|
jobs:
|
||||||
- misspell
|
- misspell
|
||||||
- markdownlint
|
- markdownlint
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
19
.mdlstyle.rb
19
.mdlstyle.rb
|
|
@ -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'
|
|
||||||
33
Makefile
33
Makefile
|
|
@ -3,12 +3,10 @@ ALL_DOC := $(shell find . -name '*.md' -type f | sort)
|
||||||
|
|
||||||
TOOLS_DIR := ./.tools
|
TOOLS_DIR := ./.tools
|
||||||
MISSPELL_BINARY=$(TOOLS_DIR)/misspell
|
MISSPELL_BINARY=$(TOOLS_DIR)/misspell
|
||||||
|
MARKDOWN_LINK_CHECK=markdown-link-check
|
||||||
.PHONY: precommit
|
|
||||||
precommit: install-misspell misspell
|
|
||||||
|
|
||||||
.PHONY: install-misspell
|
.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
|
go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell
|
||||||
|
|
||||||
.PHONY: misspell
|
.PHONY: misspell
|
||||||
|
|
@ -18,3 +16,30 @@ misspell:
|
||||||
.PHONY: misspell-correction
|
.PHONY: misspell-correction
|
||||||
misspell-correction:
|
misspell-correction:
|
||||||
$(MISSPELL_BINARY) -w $(ALL_DOCS)
|
$(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'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue