| 1 |
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) |
| 2 |
my-filter-out = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v))) |
| 3 |
testfiles ?= $(sort $(call my-filter-out,node_modules/,$(call rwildcard,../..,*.md))) |
| 4 |
|
| 5 |
all: test |
| 6 |
|
| 7 |
test: info offensive-wording remark markdownlint spellcheck |
| 8 |
@echo "" |
| 9 |
@echo "--- OK. ---" |
| 10 |
.PHONY: test |
| 11 |
|
| 12 |
info: deps |
| 13 |
@echo "" |
| 14 |
@echo "==> Files to check:" |
| 15 |
@echo " $(testfiles:../.%=%)" |
| 16 |
.PHONY: info |
| 17 |
|
| 18 |
offensive-wording: deps |
| 19 |
@echo "" |
| 20 |
@echo "==> Checking for inconsiderate/insensitive wording..." |
| 21 |
@node_modules/.bin/alex --diff $(testfiles) || true |
| 22 |
.PHONY: offensive-wording |
| 23 |
|
| 24 |
spellcheck: deps |
| 25 |
@echo "" |
| 26 |
@echo "==> Checking for spelling errors..." |
| 27 |
@node_modules/.bin/mdspell --report --en-us --ignore-numbers --ignore-acronyms $(testfiles) |
| 28 |
.PHONY: spellcheck |
| 29 |
|
| 30 |
remark: deps |
| 31 |
@echo "" |
| 32 |
@echo "==> Checking for messy formatting..." |
| 33 |
@node_modules/.bin/remark --frail $(testfiles) |
| 34 |
.PHONY: remark |
| 35 |
|
| 36 |
markdownlint: deps |
| 37 |
@echo "" |
| 38 |
@echo "==> Checking for good practices..." |
| 39 |
@node_modules/.bin/markdownlint $(testfiles) |
| 40 |
.PHONY: markdownlint |
| 41 |
|
| 42 |
deps: node_modules/ |
| 43 |
node_modules/: package.json |
| 44 |
npm install |
| 45 |
touch $@ |
| 46 |
.PHONY: deps |