Skip to content

Commit 022fdfb

Browse files
authored
Add markdownlint workflow (#920)
1 parent 00f4868 commit 022fdfb

File tree

27 files changed

+191
-90
lines changed

27 files changed

+191
-90
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,19 @@ jobs:
7272
link-check:
7373
uses: ./.github/workflows/reusable-link-check.yml
7474

75+
markdown-lint-check:
76+
uses: ./.github/workflows/reusable-markdown-lint.yml
77+
7578
required-status-check:
7679
needs:
7780
- build
7881
- test-declarative-configuration-run
82+
- markdown-lint-check
7983
runs-on: ubuntu-latest
8084
if: always()
8185
steps:
8286
- if: >
8387
needs.build.result != 'success' ||
84-
needs.test-declarative-configuration-run.result != 'success'
88+
needs.test-declarative-configuration-run.result != 'success' ||
89+
needs.markdown-lint-check.result != 'success'
8590
run: exit 1
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Reusable - Markdown lint check
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
markdown-lint-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
14+
15+
- uses: jdx/mise-action@9dc7d5dd454262207dea3ab5a06a3df6afc8ff26 # v3.4.1
16+
17+
- name: Run markdownlint
18+
run: |
19+
if ! mise run lint:markdown; then
20+
echo "markdownlint failed. To auto-fix many issues locally, run:"
21+
echo " mise run lint:markdown --fix"
22+
exit 1
23+
fi

.markdownlint.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
2+
# and https://github.com/DavidAnson/markdownlint-cli2
3+
4+
ul-style: false
5+
line-length: false
6+
no-duplicate-heading:
7+
siblings_only: true
8+
ol-prefix:
9+
style: ordered
10+
no-inline-html: false
11+
fenced-code-language: false
12+
no-trailing-punctuation:
13+
punctuation: ".,;:" # allowing exclamation points and question marks at end of sentences

.mise/tasks/lint/markdown.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Lint markdown files"
3+
#MISE flag "--fix" help="Automatically fix issues"
4+
5+
set -e
6+
7+
if [ "${usage_fix}" = "true" ]; then
8+
markdownlint-cli2 --fix "**/*.md"
9+
else
10+
markdownlint-cli2 "**/*.md"
11+
fi

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ To build the project, run:
1717
./gradlew assemble
1818
```
1919

20+
## Markdown linting
21+
22+
This repository uses [markdownlint](https://github.com/DavidAnson/markdownlint) via `markdownlint-cli2` managed by [mise](https://github.com/jdx/mise).
23+
24+
To check all Markdown files:
25+
26+
```bash
27+
mise run lint:markdown
28+
```
29+
30+
To automatically fix fixable issues:
31+
32+
```bash
33+
mise run lint:markdown --fix
34+
```
35+
2036
## Style guide
2137

2238
This repository follows the OpenTelemetry Java

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,75 +22,75 @@ To build the all of examples, run:
2222
## Example Modules
2323

2424
- [Using the SDK AutoConfiguration module](autoconfigure)
25-
- This module contains a fully functional example of using the autoconfigure
25+
- This module contains a fully functional example of using the autoconfigure
2626
SDK extension module to configure the SDK using only environment
2727
variables (or system properties).
28-
- Note: the `opentelemetry-sdk-extension-autoconfigure` module is still
28+
- Note: the `opentelemetry-sdk-extension-autoconfigure` module is still
2929
experimental at this time.
3030
- [Manual instrumentation of HTTP](http)
31-
- This module provides an example of writing manual instrumentation for
31+
- This module provides an example of writing manual instrumentation for
3232
HTTP, both client and server.
33-
- Note: More production-ready instrumentation for HTTP is provided as part
33+
- Note: More production-ready instrumentation for HTTP is provided as part
3434
of the [OpenTelemetry Java Instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation)
3535
project.
3636
- [Manual span creation and baggage propagation](manual-tracing)
37-
- This module provides an example of manually creating spans using the
37+
- This module provides an example of manually creating spans using the
3838
OpenTelemetry API with the ExtendedTracer.
39-
- Additionally, it demonstrates how to use the OpenTelemetry API to
39+
- Additionally, it demonstrates how to use the OpenTelemetry API to
4040
propagate baggage items.
4141
- [Configuring the Jaeger Exporter](jaeger)
42-
- This module contains a fully functional example of configuring the
42+
- This module contains a fully functional example of configuring the
4343
OpenTelemetry SDK to use a Jaeger exporter and send spans to it
4444
using the OpenTelemetry API.
45-
- Note: This example requires Docker to be installed.
45+
- Note: This example requires Docker to be installed.
4646
- [Using the OpenTelemetry Java Agent](javaagent)
47-
- This module demonstrates using the OpenTelemetry Java Agent with a simple
47+
- This module demonstrates using the OpenTelemetry Java Agent with a simple
4848
Spring Boot application. Traces, metrics, and logs are exported to a
4949
collector via OTLP.
5050
- [Spring native image telemetry with OpenTelemetry Spring Starter](spring-native)
51-
- This module demonstrates using the OpenTelemetry Spring Boot starter with a
51+
- This module demonstrates using the OpenTelemetry Spring Boot starter with a
5252
GraalVM native image. Traces and metrics are exported to a collector via OTLP.
5353
- [Configuring Log Appenders](log-appender)
54-
- This module demonstrates how to configure the Log4j and Logback appenders to
54+
- This module demonstrates how to configure the Log4j and Logback appenders to
5555
bridge logs into the OpenTelemetry Log SDK.
5656
- [Configuring the Logging Exporters](logging)
57-
- This module contains a fully functional example of configuring the
57+
- This module contains a fully functional example of configuring the
5858
OpenTelemetry SDK to use a logging exporter.
5959
- [Exporting application logs using JSON logging in Kubernetes](logging-k8s-stdout-otlp-json)
60-
- This module demonstrates how to export application logs using JSON logging
60+
- This module demonstrates how to export application logs using JSON logging
6161
in Kubernetes.
6262
- [Using the OpenTelemetry metrics API](metrics)
63-
- This module contains examples of using the OpenTelemetry metrics APIs.
63+
- This module contains examples of using the OpenTelemetry metrics APIs.
6464
- [Using OpenTelemetry Micrometer shim](micrometer-shim)
65-
- This module contains an example of a typical Micrometer setup (Spring Boot
65+
- This module contains an example of a typical Micrometer setup (Spring Boot
6666
with Spring Boot Actuator) configured to bridge metrics to OpenTelemetry
6767
with the Micrometer shim.
68-
- Note: The Micrometer shim is still experimental at this time.
68+
- Note: The Micrometer shim is still experimental at this time.
6969
- [Setting up OTLP exporters](otlp)
70-
- OTLP is the OpenTelemetry Protocol. This module demonstrates how to
70+
- OTLP is the OpenTelemetry Protocol. This module demonstrates how to
7171
configure the OTLP exporters and send data to the OpenTelemetry Collector
7272
using them.
73-
- Note: This example requires Docker to be installed.
73+
- Note: This example requires Docker to be installed.
7474
- [Setting up the Prometheus exporter](prometheus)
75-
- This module shows how to configure the OpenTelemetry SDK to expose an
75+
- This module shows how to configure the OpenTelemetry SDK to expose an
7676
endpoint that can be scraped by Prometheus.
77-
- Note: The Prometheus metric reader is still experimental at this time.
77+
- Note: The Prometheus metric reader is still experimental at this time.
7878
- [Manually Configuring the SDK](sdk-usage)
79-
- This module shows some concrete examples of manually configuring the
79+
- This module shows some concrete examples of manually configuring the
8080
OpenTelemetry SDK for tracing.
8181
- [Telemetry Testing](telemetry-testing)
82-
- This module demonstrates how to test OpenTelemetry instrumentation with
82+
- This module demonstrates how to test OpenTelemetry instrumentation with
8383
MockServer.
8484
- [Setting up the Zipkin exporter](zipkin)
85-
- This module contains a fully functional example of configuring the
85+
- This module contains a fully functional example of configuring the
8686
OpenTelemetry SDK to use a Zipkin exporter and send spans to a
8787
Zipkin backend using the OpenTelemetry API.
88-
- Note: This example requires Docker to be installed.
88+
- Note: This example requires Docker to be installed.
8989
- [Declarative Configuration with the OpenTelemetry Java Agent](javaagent-declarative-configuration)
90-
- This module demonstrates how to use declarative configuration with the
90+
- This module demonstrates how to use declarative configuration with the
9191
OpenTelemetry Java Agent to configure tracing behavior, including
9292
excluding specific endpoints from tracing.
93-
- Note: This example requires Java 17 or higher.
93+
- Note: This example requires Java 17 or higher.
9494

9595
## Contributing
9696

declarative-configuration/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This example demonstrates how to use [declarative configuration](https://opentel
44

55
The configuration file is located at [otel-sdk-config.yaml](./otel-sdk-config.yaml).
66

7-
# How to Run
7+
## How to Run
88

9-
## Prerequisites
9+
### Prerequisites
1010

1111
* Java 17 or higher is required to run Gradle and build this example
1212
* Java 8 or higher may be used to run the example once it has been built

doc-snippets/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
The projects in this directory contain code snippets that are used in the OpenTelemetry
2-
documentation in https://opentelemetry.io/docs/languages/java/ and
3-
https://opentelemetry.io/docs/zero-code/java/.
1+
# Documentation Snippets
2+
3+
The projects in this directory contain code snippets that are used in the OpenTelemetry
4+
documentation in <https://opentelemetry.io/docs/languages/java/> and
5+
<https://opentelemetry.io/docs/zero-code/java/>.

doc-snippets/extensions-minimal/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ This module includes OATS (OpenTelemetry Acceptance Tests) to verify the extensi
2525
### Prerequisites
2626

2727
Install OATS:
28+
2829
```bash
2930
go install github.com/grafana/oats@latest
3031
```
3132

3233
Build both the extension and the test application:
34+
3335
```bash
3436
cd /path/to/opentelemetry-java-examples
3537
./gradlew :doc-snippets:extensions-testapp:jar :doc-snippets:extensions-minimal:shadowJar
@@ -42,4 +44,4 @@ cd doc-snippets/extensions-minimal
4244
oats oats/oats.yaml
4345
```
4446

45-
The test will verify that the custom `custom.processor: "active"` attribute is added to all spans.
47+
The test will verify that the custom `custom.processor: "active"` attribute is added to all spans.

doc-snippets/extensions-testapp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ curl http://localhost:8080/hello
3434
## Usage with Extensions
3535

3636
This application is designed to be used with the extensions-minimal module to test custom OpenTelemetry extensions.
37-
See the extensions-minimal readme for details on running OATS tests.
37+
See the extensions-minimal readme for details on running OATS tests.

0 commit comments

Comments
 (0)