forked from open-telemetry/opentelemetry-specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (47 loc) · 1.82 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# All documents to be used in spell check.
ALL_DOCS := $(shell find . -name '*.md' -not -path './.github/*' -type f | grep -v ^./node_modules | sort)
PWD := $(shell pwd)
TOOLS_DIR := ./internal/tools
MISSPELL_BINARY=bin/misspell
MISSPELL = $(TOOLS_DIR)/$(MISSPELL_BINARY)
MARKDOWN_LINK_CHECK=markdown-link-check
MARKDOWN_LINT=markdownlint
.PHONY: install-misspell
install-misspell:
# TODO: Check for existence before installing
cd $(TOOLS_DIR) && go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell
.PHONY: misspell
misspell:
$(MISSPELL) -error $(ALL_DOCS)
.PHONY: misspell-correction
misspell-correction:
$(MISSPELL) -w $(ALL_DOCS)
.PHONY: install-markdown-link-check
install-markdown-link-check:
# TODO: Check for existence before installing
npm install -g $(MARKDOWN_LINK_CHECK)
.PHONY: markdown-link-check
markdown-link-check:
@for f in $(ALL_DOCS); do $(MARKDOWN_LINK_CHECK) --quiet --config .markdown_link_check_config.json $$f; done
.PHONY: install-markdownlint
install-markdownlint:
# TODO: Check for existence before installing
npm install -g markdownlint-cli
.PHONY: markdownlint
markdownlint:
@for f in $(ALL_DOCS); do echo $$f; $(MARKDOWN_LINT) -c .markdownlint.yaml $$f || exit 1; done
.PHONY: table-generation
table-generation:
docker run --rm -v $(PWD)/semantic_conventions:/source -v $(PWD)/specification:/spec otel/semconvgen -f /source markdown -md /spec
# Run all checks in order of speed / likely failure.
.PHONY: check
check: misspell markdownlint markdown-link-check
@echo "All checks complete"
# Attempt to fix issues / regenerate tables.
.PHONY: fix
fix: table-generation misspell-correction
@echo "All autofixes complete"
# Attempt to install all the tools
.PHONY: install-tools
install-tools: install-misspell install-markdownlint install-markdown-link-check
@echo "All tools installed"