Skip to content

Commit 24b427f

Browse files
committed
Lint docs using markdownlint-cli via pre-commit
1 parent 790744e commit 24b427f

14 files changed

+119
-54
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ indent_size = 2
1313
indent_style = space
1414
indent_size = 2
1515

16-
[{.golang-ci.yml,.markdownlint.json, docker-compose.yml, enduro.toml}]
16+
[{.golang-ci.yml,.markdownlint.jsonc, docker-compose.yml, enduro.toml}]
1717
indent_style = space
1818
indent_size = 2

.github/workflows/pre-commit.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v4
14+
- uses: pre-commit/action@v3.0.0

.github/workflows/workflowcheck.yml

-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ jobs:
2121
run: go install go.temporal.io/sdk/contrib/tools/workflowcheck@latest
2222
- name: Run workflowcheck
2323
run: workflowcheck ./...
24-

.markdownlint.json

-3
This file was deleted.

.markdownlint.jsonc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"default": true,
3+
"MD010": {
4+
"code_blocks": false
5+
},
6+
"MD013": {
7+
"code_blocks": false
8+
},
9+
}

.pre-commit-config.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
exclude: |
7+
(?x)^(
8+
dashboard/src/openapi-generator|
9+
internal/api/gen
10+
)
11+
- repo: https://github.com/igorshubovych/markdownlint-cli
12+
rev: v0.37.0
13+
hooks:
14+
- id: markdownlint
15+
files: 'docs/.*(?<!\.rst)$'

docs/requirements.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
mkdocs
22
mkdocs-autorefs
33
mkdocs-literate-nav
4+
pre-commit

docs/requirements.txt

+21-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
#
55
# pip-compile
66
#
7+
cfgv==3.4.0
8+
# via pre-commit
79
click==8.1.7
810
# via mkdocs
11+
distlib==0.3.7
12+
# via virtualenv
13+
filelock==3.13.1
14+
# via virtualenv
915
ghp-import==2.1.0
1016
# via mkdocs
17+
identify==2.5.31
18+
# via pre-commit
1119
jinja2==3.1.2
1220
# via mkdocs
1321
markdown==3.5.1
@@ -29,21 +37,33 @@ mkdocs-autorefs==0.5.0
2937
# via -r requirements.in
3038
mkdocs-literate-nav==0.6.1
3139
# via -r requirements.in
40+
nodeenv==1.8.0
41+
# via pre-commit
3242
packaging==23.2
3343
# via mkdocs
3444
pathspec==0.11.2
3545
# via mkdocs
3646
platformdirs==3.11.0
37-
# via mkdocs
47+
# via
48+
# mkdocs
49+
# virtualenv
50+
pre-commit==3.5.0
51+
# via -r requirements.in
3852
python-dateutil==2.8.2
3953
# via ghp-import
4054
pyyaml==6.0.1
4155
# via
4256
# mkdocs
57+
# pre-commit
4358
# pyyaml-env-tag
4459
pyyaml-env-tag==0.1
4560
# via mkdocs
4661
six==1.16.0
4762
# via python-dateutil
63+
virtualenv==20.24.6
64+
# via pre-commit
4865
watchdog==3.0.0
4966
# via mkdocs
67+
68+
# The following packages are considered to be unsafe in a requirements file:
69+
# setuptools

docs/src/dev-manual/devel.md

+33-31
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## Local/Development environment
1+
# Local/Development environment
22

33
Enduro uses Tilt to set up a local environment building the Docker images in a
44
Kubernetes cluster. It has been tested with k3d, Minikube and Kind.
55

6-
### Requirements
6+
## Requirements
77

88
- [Docker] (v18.09+)
99
- [kubectl]
@@ -24,18 +24,19 @@ so that you don’t have to run Tilt with `sudo`. *Note that managing Docker as
2424
non-root user is **different** from running the docker daemon as a non-root user
2525
(rootless).*
2626

27-
#### Dex host
27+
### Dex host
2828

2929
To make authentication work from the host browser and from within the cluster,
3030
the following entry needs to be added to your `/etc/hosts` file:
3131

32-
```
32+
```text
3333
127.0.0.1 dex
3434
```
35+
3536
For Windows/WSL2 users, open Notepad, as an Administrator, and then add the above
3637
to your `etc/hosts` file located like `C:/Windows/System32/drivers/etc/hosts`.
3738

38-
### Requirements for development
39+
## Requirements for development
3940

4041
While we run the services inside a Kubernetes cluster we recomend to install
4142
Go, Node and other tools locally to ease the development process.
@@ -46,7 +47,7 @@ Go, Node and other tools locally to ease the development process.
4647

4748
If using Linux, Node.js binary distributions are available from [NodeSource].
4849

49-
### Editor
50+
## Editor
5051

5152
As source-code editor, we strongly recommended [Visual Studio Code] for its
5253
great out-of-the-box support for Go and TypeScript. The project includes some
@@ -59,51 +60,51 @@ extensions:
5960
- Prettier - Code formatter
6061
- ESLint
6162

62-
### Set up
63+
## Set up
6364

6465
Start a local Kubernetes cluster with a local registry. For example, with k3d:
6566

66-
```
67+
```bash
6768
k3d cluster create sdps-local --registry-create sdps-registry
6869
```
6970

7071
Make sure kubectl is available and configured to use that cluster:
7172

72-
```
73+
```bash
7374
kubectl config view
7475
```
7576

7677
Clone this repository and move into its folder if you have not done that
7778
previously:
7879

79-
```
80+
```bash
8081
git clone git@github.com:artefactual-sdps/enduro.git
8182
cd enduro
8283
```
8384

8485
Bring up the environment:
8586

86-
```
87+
```bash
8788
tilt up
8889
```
8990

9091
While the Docker images are built/downloaded and the Kubernetes resources are
9192
created, hit `space` to open the Tilt UI in your browser. Check the [Tilt UI]
9293
documentation to know more about it.
9394

94-
### Access
95+
## Access
9596

9697
There are four services available from the host:
9798

98-
- Enduro dashboard: http://localhost:8080
99-
- Minio console: http://localhost:7460 (username: minio, password: minio123)
100-
- Temporal UI: http://localhost:7440
99+
- Enduro dashboard: <http://localhost:8080>
100+
- Minio console: <http://localhost:7460> (username: minio, password: minio123)
101+
- Temporal UI: <http://localhost:7440>
101102

102-
### Live updates
103+
## Live updates
103104

104105
Tilt, by default, will watch for file changes in the project folder and it will
105106
sync those changes, rebuild the Docker images and recreate the resources when
106-
necessary. However, we have *disabled* auto-load within the Tiltfile to reduce
107+
necessary. However, we have _disabled_ auto-load within the Tiltfile to reduce
107108
the use of hardware resources. There are refresh buttons on each resource in the
108109
Tilt UI that allow triggering manual updates and re-executing jobs and local
109110
resources. You can also set the `trigger_mode` env string to `TRIGGER_MODE_AUTO`
@@ -113,47 +114,48 @@ The `enduro-dashboard` uses Vite to serve the application in development
113114
with hot reload. The `enduro` and `enduro-a3m-worker` services require rebuilding
114115
the entire images - these will take longer to update.
115116

116-
### Stop/start the environment
117+
## Stop/start the environment
117118

118119
Run `ctrl-c` on the terminal where `tilt up` is running and stop the cluster
119120
with:
120121

121-
```
122+
```bash
122123
k3d cluster stop sdps-local
123124
```
124125

125126
To start the environment again:
126127

127-
```
128+
```bash
128129
k3d cluster start sdps-local
129130
tilt up
130131
```
131132

132-
### Clear the cluster
133+
## Clear the cluster
133134

134135
> Check the Tilt UI helpers below to just flush the existing data.
135136
136137
To remove the resources created by Tilt in the cluster, execute:
137138

138-
```
139+
```bash
139140
tilt down
140141
```
142+
141143
Note that it will take some time to delete the persistent volumes when you
142144
run `tilt down` and flushing the existing data does not delete the cluster.
143145
To delete the volumes immediately, you can delete the cluster.
144146

145-
### Delete the cluster
147+
## Delete the cluster
146148

147149
Deleting the cluster will remove all the resources immediatly, deleting
148150
cluster container from the host. With k3d, run:
149151

150-
```
152+
```bash
151153
k3d cluster delete sdps-local
152154
```
153155

154-
### Tilt UI helpers
156+
## Tilt UI helpers
155157

156-
#### Upload to Minio
158+
### Upload to Minio
157159

158160
In the Tilt UI header there is a cloud icon/button that allows you to configure
159161
and trigger an upload to the `sips` bucket in Minio. Click the caret to set the
@@ -169,19 +171,19 @@ sure you update `/path/to/enduro` to the proper project folder in the host):
169171
Alternatively, you can use the Enduro API to upload the file like in the
170172
following example:
171173

172-
```
174+
```bash
173175
curl \
174176
-F "file=@/path/to/enduro/hack/sampledata/StructB-AM.zip" \
175177
http://localhost:9000/upload/upload
176178
```
177179

178-
#### Flush
180+
### Flush
179181

180182
Also in the Tilt UI header, click the trash button to flush the existing data.
181183
This will recreate the MySQL databases and the MinIO buckets, and restart the
182184
required resources.
183185

184-
#### Generators
186+
### Generators
185187

186188
Grouped as tools, there are some code generators:
187189

@@ -192,9 +194,9 @@ Grouped as tools, there are some code generators:
192194
This resources need to be triggered manually by default, but they can be
193195
configured to run automatically on code changes in the Tilt UI.
194196

195-
### Known issues
197+
## Known issues
196198

197-
#### Minio uploads don't trigger workflows
199+
### MinIO uploads don't trigger workflows
198200

199201
The setup of the Minio buckets and the communication between Minio and Redis
200202
is sometimes not setup properly. To solve it, from the Tilt UI, restart the

docs/src/dev-manual/docs.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,16 @@ Optionally, synchronize the environment:
3131

3232
## Writing workflow
3333

34-
Run the builtin development server with live reloading support:
34+
Run the builtin development server with live reloading support, which should
35+
be accessible under <http://127.0.0.1:8000/>.
3536

3637
mkdocs serve
3738

38-
The docs servers should be accessible under http://127.0.0.1:8000/.
39+
Run the following command to perform some basic linting before pushing your
40+
changes to GitHub:
41+
42+
pre-commit run --all-files
43+
44+
The previous command uses `markdownlint-cli` to lint the docs using a library
45+
of [rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md).
46+
Please follow the link to troubleshoot any linting issues.

docs/src/dev-manual/logging.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ Don't use the [Temporal Go SDK logger] if possible.
115115
We want to avoid excessive error logging. As [Dave Cheney suggested], there are
116116
just two things that we should log:
117117

118-
- _Things that users care about when using your software._<br />
118+
- _Things that users care about when using your software._\
119119
Mostly errors, using `logger.Error()`. Use `logger.Info()` very sparely.
120120
- _Things that developers care about when they are developing or debugging
121-
software._<br/>
121+
software._\
122122
Use V-Levels (gte 1), e.g.: `logger.V(1).Info()`.
123123

124124
## How do I choose my V-levels? (from the logr docs)

docs/src/dev-manual/make.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Dependencies are downloaded automatically.
1111

1212
`make gen-mock` generates mock interfaces with [mockgen](https://github.com/golang/mock).
1313

14-
New mocks can be added to the project by adding a new `mockgen` line to `Makefile` that specifies the mock details (e.g. source, destination, package).
14+
New mocks can be added to the project by adding a new `mockgen` line to
15+
`Makefile` that specifies the mock details (e.g. source, destination, package).
1516

1617
## make lint
1718

0 commit comments

Comments
 (0)