Skip to content

Commit

Permalink
feat: lint sh (dragonflyoss#876)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Dec 6, 2021
1 parent c36e78c commit 96ebe93
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ jobs:
- name: Markdown lint
uses: docker://avtodev/markdown-lint:v1
with:
config: '.markdownlint.yml'
args: '**/*.md'
ignore: 'deploy/helm-charts manager/console CHANGELOG.md docs/en/api-reference docs/zh-CN/api-reference docs/en/cli-reference/dfget.1.md'
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD010: false
MD013:
line_length: 120
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@ kind-load-manager:
@./hack/kind-load.sh manager
.PHONY: kind-load-manager

# Run code lint
lint: markdownlint
@echo "Begin to golangci-lint."
@golangci-lint run
.PHONY: lint

# Run markdown lint
markdownlint:
@echo "Begin to markdownlint."
@./hack/markdownlint.sh
.PHONY: markdownlint

# Run go generate
generate:
@go generate ${PKG_LIST}
Expand Down Expand Up @@ -295,6 +307,8 @@ help:
@echo "make kind-load-scheduler kind load scheduler docker image"
@echo "make kind-load-dfdaemon kind load dfdaemon docker image"
@echo "make kind-load-manager kind load manager docker image"
@echo "make lint run code lint"
@echo "make markdownlint run markdown lint"
@echo "make swag generate swagger api docs"
@echo "make changelog generate CHANGELOG.md"
@echo "make generate run go generate"
Expand Down
16 changes: 16 additions & 0 deletions hack/markdownlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

LINT_DIR=/data
MARKDOWNLINT_IMAGE=avtodev/markdown-lint:v1

docker run --rm \
-v "$(PWD):${LINT_DIR}:ro" \
${MARKDOWNLINT_IMAGE} \
-c "${LINT_DIR}/.markdownlint.yml" /data/**/*.md \
-i "${LINT_DIR}/CHANGELOG.md" \
-i "${LINT_DIR}/docs/en/api-reference/api-reference.md" \
-i "${LINT_DIR}/docs/en/api-reference" \
-i "${LINT_DIR}/deploy/helm-charts" \
-i "${LINT_DIR}/docs/zh-CN/api-reference" \
-i "${LINT_DIR}/manager/console" \
-i "${LINT_DIR}/docs/en/cli-reference/dfget.1.md"

0 comments on commit 96ebe93

Please sign in to comment.