-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
44 lines (38 loc) · 1.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env make
.DEFAULT_GOAL := help
MD_LINT_CONTAINER := craighurley/markdownlint-cli:latest
SHELLCHECK_CONTAINER := craighurley/shellcheck:latest
YAML_LINT_CONTAINER := craighurley/yamllint:latest
TARGET_MAX_CHAR_NUM := 20
## Print this help
help:
@echo 'Usage:'
@echo ' make <target>'
@echo ''
@echo 'Targets:'
@awk '/(^[a-zA-Z\-\.\_0-9]+:)|(^###[a-zA-Z]+)/ { \
header = match($$1, /^###(.*)/); \
if (header) { \
title = substr($$1, 4, length($$1)); \
printf "%s\n", title; \
} \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " %-$(TARGET_MAX_CHAR_NUM)s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
.PHONY: help
## Clean
clean:
@echo $@
.PHONY: clean
## Run linters
lint:
@echo $@
docker run --rm -v "$$PWD":/workdir:ro $(MD_LINT_CONTAINER) -c .markdownlintrc "**/*.md"
docker run --rm -v "$$PWD":/workdir:ro $(SHELLCHECK_CONTAINER) **/*.sh
docker run --rm -v "$$PWD":/workdir:ro $(YAML_LINT_CONTAINER) -c .yamllint ./
.PHONY: lint