Skip to content

Commit 3bf9a08

Browse files
committed
Add hack/markdownlint.sh and fix warnings
The script disables one rule and makes it clear how to disable others in the future. Unfortunately, mdl doesn't include a blacklist option. You can either run all rules, or specify a list of rules.
1 parent 45a8c5f commit 3bf9a08

6 files changed

+96
-30
lines changed

docs/api.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ details, etc.
154154
* *validation error* -- The provisioning steps found an error.
155155
* *provisioning* -- An image is being written to the host's disk(s).
156156
* *provisioning error* -- The image could not be written to the host.
157-
* *provisioned* -- An image has been completely written to the host's disk(s).
157+
* *provisioned* -- An image has been completely written to the host's
158+
disk(s).
158159
* *externally provisioned* -- Metal³ does not manage the image on the host.
159160
* *deprovisioning* -- The image is being wiped from the host's disk(s).
160161
* *inspecting* -- The hardware details for the host are being collected

docs/baremetalhost-states.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# BaremetalHost Provisioning States
22

3-
The following diagram shows the possible Provisioning State transitions for the BaremetalHost object:
3+
The following diagram shows the possible Provisioning State transitions for the
4+
BaremetalHost object:
45

56
![BaremetalHost ProvisioningState transitions](BaremetalHost_ProvisioningState.png)
67

docs/dev-setup.md

+24-22
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
Setup Development Environment
2-
=============================
1+
# Setup Development Environment
32

43
## Install the operator-sdk
54

65
Follow the instructions in the Quick Start section of
7-
https://github.com/operator-framework/operator-sdk to check out and
6+
<https://github.com/operator-framework/operator-sdk> to check out and
87
install the operator-sdk tools.
98

109
## With minikube
1110

1211
1. Install and launch minikube
1312

14-
https://kubernetes.io/docs/setup/minikube/
13+
<https://kubernetes.io/docs/setup/minikube/>
1514

16-
3. Create a namespace to host the operator
15+
1. Create a namespace to host the operator
1716

18-
```
17+
```bash
1918
kubectl create namespace metal3
2019
```
2120

22-
4. Install operator-sdk
21+
1. Install operator-sdk
2322

24-
```
23+
```bash
2524
eval $(go env)
2625
mkdir -p $GOPATH/src/github.com/metal3-io
2726
cd $GOPATH/src/github.com/metal3-io
@@ -33,9 +32,9 @@ install the operator-sdk tools.
3332
kubectl apply -f deploy/crds/metal3_v1alpha1_baremetalhost_crd.yaml
3433
```
3534

36-
5. Launch the operator locally
35+
1. Launch the operator locally
3736

38-
```
37+
```bash
3938
export OPERATOR_NAME=baremetal-operator
4039
export DEPLOY_KERNEL_URL=http://172.22.0.1/images/ironic-python-agent.kernel
4140
export DEPLOY_RAMDISK_URL=http://172.22.0.1/images/ironic-python-agent.initramfs
@@ -44,9 +43,9 @@ install the operator-sdk tools.
4443
operator-sdk up local --namespace=metal3
4544
```
4645

47-
6. Create the CR
46+
1. Create the CR
4847

49-
```
48+
```bash
5049
kubectl apply -f deploy/crds/example-host.yaml -n metal3
5150
```
5251

@@ -57,7 +56,7 @@ is to be able to have some test data, use the test fixture provisioner
5756
instead of the real Ironic provisioner by passing `-test-mode` to the
5857
operator when launching it.
5958

60-
```
59+
```bash
6160
operator-sdk up local --operator-flags "-test-mode"
6261
```
6362

@@ -74,8 +73,9 @@ your environment.
7473

7574
## Using libvirt VMs with Ironic
7675

77-
In order to use VMs as hosts, they need to be connected to [vbmc](https://docs.openstack.org/tripleo-docs/latest/install/environments/virtualbmc.html) and
78-
the `bootMACAddress` field needs to be set to the MAC address of the
76+
In order to use VMs as hosts, they need to be connected to
77+
[vbmc](https://docs.openstack.org/tripleo-docs/latest/install/environments/virtualbmc.html)
78+
and the `bootMACAddress` field needs to be set to the MAC address of the
7979
network interface that will PXE boot.
8080

8181
For example:
@@ -98,7 +98,7 @@ registering a host. It takes as input the name of the `virsh` domain
9898
and produces as output the basic YAML to register that host properly,
9999
with the boot MAC address and BMC address filled in.
100100

101-
```
101+
```bash
102102
$ go run cmd/make-virt-host/main.go openshift_worker_1
103103
---
104104
apiVersion: v1
@@ -125,16 +125,17 @@ spec:
125125

126126
The output can be passed directly to `oc apply` like this:
127127

128-
```
129-
$ go run cmd/make-virt-host/main.go openshift_worker_1 | oc apply -f -
128+
```bash
129+
go run cmd/make-virt-host/main.go openshift_worker_1 | oc apply -f -
130130
```
131131

132132
When the host is a *master*, include the `-consumer` and
133133
`-consumer-namespace` options to associate the host with the existing
134134
`Machine` object.
135135

136-
```
137-
$ go run cmd/make-virt-host/main.go -consumer ostest-master-1 -consumer-namespace openshift-machine-api openshift_master_1
136+
```bash
137+
$ go run cmd/make-virt-host/main.go -consumer ostest-master-1 \
138+
-consumer-namespace openshift-machine-api openshift_master_1
138139
---
139140
apiVersion: v1
140141
kind: Secret
@@ -166,8 +167,9 @@ spec:
166167
The `make-bm-worker` tool may be a more convenient way of creating
167168
YAML definitions for workers than editing the files directly.
168169

169-
```
170-
$ go run cmd/make-bm-worker/main.go -address 1.2.3.4 -password password -user admin worker-99
170+
```bash
171+
$ go run cmd/make-bm-worker/main.go -address 1.2.3.4 \
172+
-password password -user admin worker-99
171173
---
172174
apiVersion: v1
173175
kind: Secret

docs/publishing-images.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ your development fork.
1111
2. Set up your account on [quay.io](https://quay.io).
1212
3. Link your repository from step 1 to quay.io by following the
1313
instructions to "Create New Repository" from
14-
https://quay.io/repository/
14+
<https://quay.io/repository/>
1515

1616
1. Enter the quay.io repository name. It is good practice to use
1717
the same name as the github repo.

docs/testing.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,33 @@ The user running the tests must have permission on the cluster to
66
create CRDs. An example role binding setting for configuring the
77
"developer" user is provided in test/e2e/role_binding.yaml
88

9-
```
9+
```bash
1010
oc --as system:admin apply -f test/e2e/role_binding.yaml
1111
```
1212

1313
### Run the e2e tests
1414

1515
Run the tests using the operator-sdk command line tool
1616

17-
```
17+
```bash
1818
operator-sdk test local ./test/e2e --namespace operator-test --up-local --debug
1919
```
2020

2121
If the setup steps above have already been run, causing "X already
2222
exists" errors, use the --no-setup option to skip that step in the test.
2323

24-
```
24+
```bash
2525
operator-sdk test local ./test/e2e --namespace operator-test --up-local --debug --no-setup
2626
```
2727

2828
The tests can also be run via `make`
2929

30-
```
30+
```bash
3131
make test
3232
```
3333

3434
Run linters test before pushing your commit
35-
```
35+
36+
```bash
3637
make lint
3738
```

hack/markdownlint.sh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
IS_CONTAINER=${IS_CONTAINER:-false}
6+
7+
if [ "${IS_CONTAINER}" != "false" ]; then
8+
TOP_DIR="${1:-.}"
9+
find "${TOP_DIR}" -path ./vendor -prune -o -name '*.md' -exec \
10+
mdl --style all --warnings \
11+
--rules "MD001,MD002,MD003,MD004,MD005,MD006,MD007,MD009,MD010,MD011,MD012,MD013,MD014,MD018,MD019,MD020,MD021,MD022,MD023,MD024,MD025,MD026,MD027,MD028,MD030,MD031,MD032,MD033,MD034,MD035,MD036,MD037,MD038,MD039,MD040,MD041" \
12+
{} \+
13+
else
14+
podman run --rm \
15+
--env IS_CONTAINER=TRUE \
16+
--volume "${PWD}:/workdir:ro,z" \
17+
--entrypoint sh \
18+
--workdir /workdir \
19+
registry.hub.docker.com/pipelinecomponents/markdownlint:latest \
20+
/workdir/hack/markdownlint.sh "${@}"
21+
fi;
22+
23+
# $ mdl --style all -l
24+
# MD001 - Header levels should only increment by one level at a time
25+
# MD002 - First header should be a top level header
26+
# MD003 - Header style
27+
# MD004 - Unordered list style
28+
# MD005 - Inconsistent indentation for list items at the same level
29+
# MD006 - Consider starting bulleted lists at the beginning of the line
30+
# MD007 - Unordered list indentation
31+
# MD009 - Trailing spaces
32+
# MD010 - Hard tabs
33+
# MD011 - Reversed link syntax
34+
# MD012 - Multiple consecutive blank lines
35+
# MD013 - Line length
36+
# MD014 - Dollar signs used before commands without showing output
37+
# MD018 - No space after hash on atx style header
38+
# MD019 - Multiple spaces after hash on atx style header
39+
# MD020 - No space inside hashes on closed atx style header
40+
# MD021 - Multiple spaces inside hashes on closed atx style header
41+
# MD022 - Headers should be surrounded by blank lines
42+
# MD023 - Headers must start at the beginning of the line
43+
# MD024 - Multiple headers with the same content
44+
# MD025 - Multiple top level headers in the same document
45+
# MD026 - Trailing punctuation in header
46+
# MD027 - Multiple spaces after blockquote symbol
47+
# MD028 - Blank line inside blockquote
48+
# MD029 - Ordered list item prefix - DISABLED
49+
# MD030 - Spaces after list markers
50+
# MD031 - Fenced code blocks should be surrounded by blank lines
51+
# MD032 - Lists should be surrounded by blank lines
52+
# MD033 - Inline HTML
53+
# MD034 - Bare URL used
54+
# MD035 - Horizontal rule style
55+
# MD036 - Emphasis used instead of a header
56+
# MD037 - Spaces inside emphasis markers
57+
# MD038 - Spaces inside code span elements
58+
# MD039 - Spaces inside link text
59+
# MD040 - Fenced code blocks should have a language specified
60+
# MD041 - First line in file should be a top level header
61+
# MD046 - Code block style - DISABLED

0 commit comments

Comments
 (0)