From b7c13242a14c7ba44c95fa2961c00bc4b5f58e17 Mon Sep 17 00:00:00 2001 From: kwanhur Date: Thu, 28 Apr 2022 17:06:04 +0800 Subject: [PATCH] Add precommit hook for markdownlint (#1038) Signed-off-by: kwanhur Signed-off-by: Song Jian --- .pre-commit-config.yaml | 6 ++++++ Makefile | 18 ------------------ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4bcfa82..0305e05a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,3 +25,9 @@ repos: rev: c3086eea8af86847dbdff2e46b85a5fe3c9d9656 hooks: - id: go-static-check + +- repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.31.1 + hooks: + - id: markdownlint + - id: markdownlint-fix \ No newline at end of file diff --git a/Makefile b/Makefile index 8c8db38a..f6757eab 100644 --- a/Makefile +++ b/Makefile @@ -32,11 +32,8 @@ GOINSTALL := $(GO) install GOFLAGS := -race STATICCHECK := staticcheck LICENSEEYE := license-eye -MDLINT := markdownlint PIP := pip3 PIPINSTALL := $(PIP) install -NPM := npm -NPMINSTALL := $(NPM) install # init arch ARCH := $(shell getconf LONG_BIT) @@ -67,12 +64,6 @@ define PIP_INSTALL_PKG @echo $(1) installed endef -define NPM_INSTALL_PKG - @echo installing $(1) - $(NPMINSTALL) $(1) - @echo $(1) installed -endef - # make, make all all: prepare compile package @@ -116,7 +107,6 @@ package: # make deps deps: - $(call NPM_INSTALL_PKG, markdownlint-cli) $(call PIP_INSTALL_PKG, pre-commit) $(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc) $(call INSTALL_PKG, staticcheck, honnef.co/go/tools/cmd/staticcheck) @@ -127,14 +117,6 @@ precommit: pre-commit autoupdate pre-commit install --install-hooks -# make mdlint -mdlint: - $(MDLINT) --ignore $(WORKROOT)/**/testdata/**/*.md $(WORKROOT) - -# make mdlint-fix -mdlint-fix: - $(MDLINT) --fix --ignore $(WORKROOT)/**/testdata/**/*.md $(WORKROOT) - # make check check: $(STATICCHECK) ./...