Skip to content

Commit

Permalink
Apply markdowlint rules in the NTAS repository
Browse files Browse the repository at this point in the history
  • Loading branch information
grego952 committed Mar 25, 2024
1 parent d7f065c commit c31fb49
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is a configuration file for the markdownlint. You can use this file to overwrite the default settings.
# MD013 is set to false by default because many files include lines longer than the conventional 80 character limit
MD013: false
# Disable the Multiple headings with the same content rule
MD024: false
# MD029 is set to false because it generated some issues with longer lists
MD029: false
# Checks if there some inline HTML-elements
MD033: false
# MD044 is used to set capitalization for the particular words. You can determine whether it should be used also for code blocks and html elements
MD044:
code_blocks: false
html_elements: false
names:
- Kyma
- Kubernetes
- ConfigMap
- CronJob
- CustomResourceDefinition
- Ingress
- Node
- PodPreset
- Pod
- ProwJob
- Secret
- ServiceBinding
- ServiceClass
- ServiceInstance
2 changes: 2 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_sidebar.md
FlowCharts.md
2 changes: 1 addition & 1 deletion docs/contributor/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ For information about the prerequisites, refer to [Development](./development.md
make deploy IMG=$IMG
```
6. To start the reconciliation process, apply the NATS Custom Resource.
6. To start the reconciliation process, apply the NATS custom resource.

```sh
kubectl apply -f config/samples/eventing-nats-eval.yaml
Expand Down
4 changes: 2 additions & 2 deletions docs/contributor/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document provides an overview of the testing activities used in this projec

> **NOTE:** The validation and defaulting rules are tested within the integration tests.
### Unit tests and Env-tests
### Unit Tests and Env-Tests

To run the unit and integration tests, the following command needs to be executed. If necessary, the needed binaries for the integration tests are downloaded to `./bin`.
Further information about integration tests can be found in the [Kubebuilder book](https://book.kubebuilder.io/reference/envtest.html).
Expand All @@ -27,7 +27,7 @@ If changes to the source code were made, or if this is your first time to execut
make generate-and-test
```

### E2E tests
### E2E Tests

Because E2E tests need a Kubernetes cluster to run on, they are separate from the remaining tests.

Expand Down
4 changes: 2 additions & 2 deletions docs/user/02-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Use the following sample CRs as guidance. Each can be applied immediately when y
| **resources** | object | Resources defines resources for NATS. |
| **resources.​claims** | \[\]object | Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. This field is immutable. It can only be set for containers. |
| **resources.​claims.​name** (required) | string | Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container. |
| **resources.​limits** | map\[string\]\{integer or string\} | Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
| **resources.​requests** | map\[string\]\{integer or string\} | Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ |
| **resources.​limits** | map\[string\]\{integer or string\} | Limits describes the maximum amount of compute resources allowed. Fore more information, check [Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). |
| **resources.​requests** | map\[string\]\{integer or string\} | Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. Fore more information, check [Resource Management for Pods and Containers](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). |

**Status:**

Expand Down
30 changes: 30 additions & 0 deletions markdown_heading_capitalization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This file is used to trigger the custom rule that checks if all markdown headings (words longer than 4 characters) are written in the title case. To run this check, you must include the check in the markdownlint command.
// For example, if you want to run the check on the `docs` folder, run the following command: `markdownlint -r ./markdown_heading_capitalization.js docs/`.
module.exports = [{
"names": [ "custom/capitalize-headings" ],
"description": "Heading words longer than 4 characters should be capitalized",
"tags": [ "formatting" ],
"function": function rule(params, onError) {
params.tokens.filter(function filterToken(token) {
return token.type === "heading_open";
}).forEach(function forToken(heading) {
var headingTokenContent = heading.line.trim();
var wordsInHeading = headingTokenContent.split(' ');

for (var i = 0; i < wordsInHeading.length; i++) {
if (wordsInHeading[i].length > 4 && wordsInHeading[i] &&
wordsInHeading[i].charAt(0) !== wordsInHeading[i].charAt(0).toUpperCase()) {
var capitalizedWord = wordsInHeading[i].charAt(0).toUpperCase() + wordsInHeading[i].slice(1);
var detailMessage = "Change " + "'" + wordsInHeading[i] + "'" + " to " + "'" + capitalizedWord + "'";

onError({
"lineNumber": heading.lineNumber,
"detail": detailMessage,
"context": headingTokenContent, // Show the whole heading as context
"range": [headingTokenContent.indexOf(wordsInHeading[i]), wordsInHeading[i].length] // Underline the word which needs a change
});
}
}
});
}
}];

0 comments on commit c31fb49

Please sign in to comment.