Skip to content

Commit d8f1d3e

Browse files
authored
Add precommit hook for markdownlint (#1038)
Signed-off-by: kwanhur <[email protected]>
1 parent 8e134e4 commit d8f1d3e

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ repos:
2525
rev: c3086eea8af86847dbdff2e46b85a5fe3c9d9656
2626
hooks:
2727
- id: go-static-check
28+
29+
- repo: https://github.com/igorshubovych/markdownlint-cli
30+
rev: v0.31.1
31+
hooks:
32+
- id: markdownlint
33+
- id: markdownlint-fix

Makefile

-18
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ GOINSTALL := $(GO) install
3232
GOFLAGS := -race
3333
STATICCHECK := staticcheck
3434
LICENSEEYE := license-eye
35-
MDLINT := markdownlint
3635
PIP := pip3
3736
PIPINSTALL := $(PIP) install
38-
NPM := npm
39-
NPMINSTALL := $(NPM) install
4037

4138
# init arch
4239
ARCH := $(shell getconf LONG_BIT)
@@ -67,12 +64,6 @@ define PIP_INSTALL_PKG
6764
@echo $(1) installed
6865
endef
6966

70-
define NPM_INSTALL_PKG
71-
@echo installing $(1)
72-
$(NPMINSTALL) $(1)
73-
@echo $(1) installed
74-
endef
75-
7667
# make, make all
7768
all: prepare compile package
7869

@@ -116,7 +107,6 @@ package:
116107

117108
# make deps
118109
deps:
119-
$(call NPM_INSTALL_PKG, markdownlint-cli)
120110
$(call PIP_INSTALL_PKG, pre-commit)
121111
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc)
122112
$(call INSTALL_PKG, staticcheck, honnef.co/go/tools/cmd/staticcheck)
@@ -127,14 +117,6 @@ precommit:
127117
pre-commit autoupdate
128118
pre-commit install --install-hooks
129119

130-
# make mdlint
131-
mdlint:
132-
$(MDLINT) --ignore $(WORKROOT)/**/testdata/**/*.md $(WORKROOT)
133-
134-
# make mdlint-fix
135-
mdlint-fix:
136-
$(MDLINT) --fix --ignore $(WORKROOT)/**/testdata/**/*.md $(WORKROOT)
137-
138120
# make check
139121
check:
140122
$(STATICCHECK) ./...

0 commit comments

Comments
 (0)