Skip to content

Commit 0ea77a9

Browse files
authored
Enable markdown-link-check (open-telemetry#541)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
1 parent 8c2d6c2 commit 0ea77a9

11 files changed

+69
-47
lines changed

.circleci/config.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,32 @@ jobs:
77
- image: circleci/golang:1.12
88
steps:
99
- checkout
10+
- run:
11+
name: Misspell Install
12+
command: make install-misspell
1013
- run:
1114
name: Misspell check
12-
command: make precommit
15+
command: make misspell
16+
1317
markdownlint:
1418
docker:
15-
- image: circleci/ruby:latest
19+
- image: node:13
1620
steps:
1721
- checkout
1822
- run:
19-
name: Install markdownlint
20-
command: gem install mdl
23+
name: Install Tools
24+
command: |
25+
make install-markdown-lint
26+
make install-markdown-link-check
2127
- run:
22-
name: Check markdownlint
23-
command: mdl -c .mdlrc .
28+
name: Run Tools
29+
command: |
30+
make markdown-lint
31+
make enforce-markdown-link-check
2432
2533
workflows:
2634
version: 2
27-
build:
35+
check-errors:
2836
jobs:
2937
- misspell
3038
- markdownlint

.markdownlint.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"default": true,
3+
"MD024": { "allow_different_nesting": true },
4+
"MD029": { "style": "ordered" },
5+
"ul-style": false, # MD004
6+
"line-length": false, # MD013
7+
"no-inline-html": false, # MD033
8+
"fenced-code-language": false # MD040
9+
}

.mdlrc

-1
This file was deleted.

.mdlstyle.rb

-19
This file was deleted.

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ one that is needlessly restrictive and complex.
4343
Markdown files should be properly formatted before a pull request is sent out.
4444
In this repository we follow the
4545
[markdownlint rules](https://github.com/DavidAnson/markdownlint#rules--aliases)
46-
with some customizations. See [mdlstyle](.mdlstyle.rb) or
46+
with some customizations. See [markdownlint](.markdownlint.yaml) or
4747
[settings](.vscode/settings.json) for details.
4848

4949
We highly encourage to use line breaks in markdown files at `80` characters
@@ -63,7 +63,7 @@ To fix style violations, follow the
6363
[instruction](https://github.com/DavidAnson/markdownlint#optionsresultversion)
6464
with the Node version of markdownlint. If you are using Visual Studio Code,
6565
you can also use the `fixAll` command of the
66-
[vscode markdownlint extension](hhttps://github.com/DavidAnson/vscode-markdownlint).
66+
[vscode markdownlint extension](https://github.com/DavidAnson/vscode-markdownlint).
6767

6868
### Misspell check
6969

@@ -81,4 +81,4 @@ To quickly fix typos, use
8181

8282
```bash
8383
make misspell-correction
84-
```
84+
```

Makefile

+29-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ ALL_DOC := $(shell find . -name '*.md' -type f | sort)
33

44
TOOLS_DIR := ./.tools
55
MISSPELL_BINARY=$(TOOLS_DIR)/misspell
6-
7-
.PHONY: precommit
8-
precommit: install-misspell misspell
6+
MARKDOWN_LINK_CHECK=markdown-link-check
97

108
.PHONY: install-misspell
11-
install-misspell: go.mod go.sum internal/tools.go
9+
install-misspell:
1210
go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell
1311

1412
.PHONY: misspell
@@ -18,3 +16,30 @@ misspell:
1816
.PHONY: misspell-correction
1917
misspell-correction:
2018
$(MISSPELL_BINARY) -w $(ALL_DOCS)
19+
20+
.PHONY: install-markdown-link-check
21+
install-markdown-link-check:
22+
npm install -g $(MARKDOWN_LINK_CHECK)
23+
24+
.PHONY: markdown-link-check
25+
markdown-link-check:
26+
find . -name \*.md -exec $(MARKDOWN_LINK_CHECK) {} \;
27+
28+
.PHONY: enforce-markdown-link-check
29+
enforce-markdown-link-check:
30+
@LINKCHECKOUT=`find . -name \*.md -exec $(MARKDOWN_LINK_CHECK) {} 2>&1 >/dev/null \;`; \
31+
if [ "$$LINKCHECKOUT" ]; then \
32+
echo "$(MARKDOWN_LINK_CHECK) FAILED => errors:\n"; \
33+
echo "Run 'make $(MARKDOWN_LINK_CHECK)' to see the errors" \
34+
exit 1; \
35+
else \
36+
echo "Check markdown links finished successfully"; \
37+
fi
38+
39+
.PHONY: install-markdown-lint
40+
install-markdown-lint:
41+
npm install -g markdownlint-cli
42+
43+
.PHONY: markdown-lint
44+
markdown-lint:
45+
markdownlint -c .markdownlint.yaml '**/*.md'

specification/api-correlationcontext.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Table of Contents
66
</summary>
77

88
- [Overview](#overview)
9-
- [CorrelationContext](#correlationcontext)
10-
- [Get correlations](#get-correlations)
11-
- [Get correlation](#get-correlation)
12-
- [Set correlation](#set-correlation)
13-
- [Remove correlation](#remove-correlation)
14-
- [Clear correlations](#clear-correlations)
9+
- [CorrelationContext](#correlationcontext)
10+
- [Get correlations](#get-correlations)
11+
- [Get correlation](#get-correlation)
12+
- [Set correlation](#set-correlation)
13+
- [Remove correlation](#remove-correlation)
14+
- [Clear correlations](#clear-correlations)
1515
- [CorrelationContext Propagation](#correlationcontext-propagation)
1616
- [Conflict Resolution](#conflict-resolution)
1717

specification/api-metrics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,4 @@ properties.
552552
Use Counter instruments to report the number of bytes read and written
553553
by the storage server. Configure the SDK to use a Correltion Context
554554
label key (e.g., named "app.user") to aggregate events by all metric
555-
instruments.
555+
instruments.

specification/context.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Table of Contents
1010
- [Get value](#get-value)
1111
- [Set value](#set-value)
1212
- [Optional operations](#optional-operations)
13-
- [Get current Context](#get-current-context)
14-
- [Attach Context](#attach-context)
15-
- [Detach Context](#detach-context)
13+
- [Get current Context](#get-current-context)
14+
- [Attach Context](#attach-context)
15+
- [Detach Context](#detach-context)
1616

1717
</details>
1818

specification/data-database.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ attribute names.
2121

2222
Additionally at least one of `net.peer.name` or `net.peer.ip` from the [network attributes][] is required and `net.peer.port` is recommended.
2323

24-
[network attributes]: data-span-general.md#general-network-connection-attributes
24+
[network attributes]: data-span-general.md#general-network-connection-attributes

specification/sdk-resource.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ When associated with a `TracerProvider`,
1919
all `Span`s produced by any `Tracer` from the provider MUST be associated with this `Resource`.
2020

2121
Analogous to distributed tracing, when used with metrics,
22-
a resource can be associated with a [MeterProvider](sdk-metrics.md#meter-sdk).
23-
When associated with a `MeterProvider`,
22+
a resource can be associated with a `MeterProvider`.
23+
When associated with a [`MeterProvider`](api-metrics-user.md#obtaining-a-meter),
2424
all `Metrics` produced by any `Meter` from the provider will be
2525
associated with this `Resource`.
2626

0 commit comments

Comments
 (0)