Skip to content

Commit

Permalink
chore: vale fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Sep 4, 2024
1 parent cf66af8 commit c6418b1
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 52 deletions.
4 changes: 2 additions & 2 deletions canary-checker/docs/concepts/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ kubectl get canaries -o wide

## Scaling

Canaries can be scaled up or down just like other kubernetes resources. However, scaling to more than one replica is identical to having just one replica. In other words, scaling a canary can be thought of as a mechanism to turn on/off the canary.
Canaries can be scaled up or down like other Kubernetes resources. However, scaling to more than one replica is identical to having one replica. In other words, scaling a canary can be thought of as a mechanism to turn on/off the canary.

<Step step={1} name="Scaling up (enabling)">

Expand All @@ -40,7 +40,7 @@ kubectl get canaries folder-pass -o wide
</Step>

<Step step={2} name="Scale down (disabling)">
This effectively stops the canary from running.
This stops the canary from running.


```bash
Expand Down
4 changes: 2 additions & 2 deletions canary-checker/docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ db:
# ...
```

The helm chart will create a postgres server statefulset, with a random password and default port, along with a new database.
The helm chart creates a postgres server statefulset, with a random password and default port, along with a new database.

To specify a username and password for the chart-managed Postgres server, create a secret in the namespace that the chart will install to, named `postgres-connection`, which contains `POSTGRES_USER` and `POSTGRES_PASSWORD` keys.

Check warning on line 48 in canary-checker/docs/database.md

View workflow job for this annotation

GitHub Actions / vale

[vale] canary-checker/docs/database.md#L48

[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.
Raw output
{"message": "[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.", "location": {"path": "canary-checker/docs/database.md", "range": {"start": {"line": 48, "column": 123}}}, "severity": "WARNING"}

## Connecting to an existing database

In order to connect to an existing Postgres server, a database must be created on the server, along with a user that has administrator permissions for the database.
To connect to an existing Postgres server, a database must be created on the server, along with a user that has administrator permissions for the database.

```yaml title="values.yaml"
db:
Expand Down
10 changes: 5 additions & 5 deletions canary-checker/docs/reference/1-http.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_class_name: popular

# <Icon name="http"/> HTTP

This check performs queries on HTTP endpoints, and HTTP Namespaces to monitor their activity.
This check performs queries on HTTP endpoints, and HTTP namespaces to monitor their activity.

```yaml title=http-check.yaml
apiVersion: canaries.flanksource.com/v1
Expand All @@ -27,8 +27,8 @@ spec:
{field: "method", description: "HTTP Request method", default: "GET", scheme: "string"},
{field: "headers", description: "Header fields", scheme: "map[string]string"},
{field: "body", description: "Request Body Contents", scheme: "string"},
{field: "tlsConfig", description: "TLS Config", scheme: "[TLSConfig](#tls-config)"},
{field: "templateBody", description: "If true body will be templated", default: false, scheme: "bool"},
{field: "tlsConfig", description: "TLS config", scheme: "[TLSConfig](#tls-config)"},
{field: "templateBody", description: "If true body is templated", default: false, scheme: "bool"},
{field: "responseCodes", description: "Expected response codes", scheme: "[]int"},
{field: "responseContent", description: "Expected response content", scheme: "string"},
{field: "thresholdMillis", description: "Request timeout", default: 5000, scheme: "int"},
Expand All @@ -42,7 +42,7 @@ spec:
{field: "ca", description: "PEM encoded certificate of the CA to verify the server certificate", scheme: "EnvVar"},
{field: "cert", description: "PEM encoded client certificate", scheme: "EnvVar"},
{field: "key", description: "PEM encoded client private key", scheme: "EnvVar"},
{field: "handshakeTimeout", description: "Timeout for SSL Handshake (defaults to 10 seconds)", scheme: "int"},
{field: "handshakeTimeout", description: "Timeout for SSL handshake (defaults to 10 seconds)", scheme: "int"},
{field: "insecureSkipVerify", description: "Controls whether a client verifies the server's certificate chain and host name", scheme: "bool"}
]}/>
Expand Down Expand Up @@ -114,7 +114,7 @@ spec:
| Name | Scheme |
| ----------------------------- | ------------------- |
| `metadata.name` | string |
| `metadata.metadata.namespace` | _string_ |
| `metadata.namespace` | _string_ |
| `metadata.labels` | _map[string]string_ |
| `{fields from []env}` | any |

Expand Down
8 changes: 4 additions & 4 deletions canary-checker/docs/reference/1-kubernetes-resource.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ check would be to see if a service is accessible via the ingress as shown in the
{
field: 'clearResources',
scheme: 'bool',
description: `When set to true, resources from previous checks will be deleted before every run.
Even though the resources are deleted at the end of a check, setting this to \`true\` will guarantee that
there are no remains from a previous failed run.`
description: `When set to true, resources from previous checks are deleted before every run.
Even though the resources are deleted at the end of a check, setting this to \`true\` guarantees that
there are no leftover resources from a previous failed run.`
},
{
field: 'waitFor',
Expand Down Expand Up @@ -147,7 +147,7 @@ Templating the **Group**, **Version**, **Kind** & **Namespace** however isn't al

:::warning
Since static resources are deleted when the canary is deleted, extra care must be taken when providing their manifests.
When this canary is deleted, the **test** namespace will be deleted and consequently all the other resources within it, even those not created by this check.
When this canary is deleted, the **test** namespace is deleted and consequently all the other resources within it, even those not created by this check.
:::

</div>
Expand Down
15 changes: 6 additions & 9 deletions canary-checker/docs/reference/1-pod.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ tags:

# <Icon name="k8s-pod" /> Pod



The Pod check creates a new pod and verifies its reachability.

The Pod check creates a new pod and verifies that it can be reached via an Ingress

```yaml title="tcp.yaml" file=../../../modules/canary-checker/fixtures/k8s/pod_pass.yaml
```

<HealthCheck name="pod" rows={[
{field: "namespace", description: "Namespace where pod will be created", scheme: 'string'},
{field: "namespace", description: "Namespace where the pod is created", scheme: 'string'},
{field: "spec", description: "Pod spec to create", scheme: '[Spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podspec-v1-core) ', required: true},
{field: "port", description: "Port on which the created pod will serve traffic", scheme: 'int'},
{field: "path", description: " Path on which the created pod will respond to requests", scheme: 'string'},
{field: "port", description: "Port on which the created pod serves traffic", scheme: 'int'},
{field: "path", description: " Path on which the created pod responds to requests", scheme: 'string'},
{field: "expectedContent", description: "Expected content in HTTP response", scheme: 'string'},
{field: "expectedHttpStatuses", description: "Expected HTTP response statuses", scheme: '[]int'},
{field: "scheduleTimeout", description: "Timeout for pod creation", scheme: 'Duration'},
Expand All @@ -29,8 +26,8 @@ The Pod check creates a new pod and verifies its reachability.
{field: "ingressTimeout", description: "Timeout waiting for ingress creation", scheme: 'Duration'},
{field: "deadline", description: "Overall deadline for pod check", scheme: 'Duration'},
{field: "httpRetryInterval", description: "Interval between HTTP retries", scheme: 'Duration'},
{field:"ingressName", description: "Name to use for the ingress object that will expose the created pod", scheme: 'string'},
{field: "ingressHost", description: " URL to be used by the ingress to expose the created pod ", scheme: 'string'},
{field:"ingressName", description: "Name to use for the ingress object that exposes the created pod", scheme: 'string'},
{field: "ingressHost", description: " URL used by the ingress to expose the created pod ", scheme: 'string'},
{field: "priorityClass", description: " Priority class to assign to the created pod", scheme: 'string'}


Expand Down
52 changes: 23 additions & 29 deletions canary-checker/docs/scripting/cel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ base64.decode("aGVsbG8=") // return b'hello'
### .keys
The `keys` method on a map returns a list of keys..
The `keys` method on a map returns a list of keys.
Syntax:
Expand All @@ -135,7 +135,7 @@ Examples:
### .merge
The `merge` method on a map takes in a second map to merge with.
The `merge` method on a map takes a second map to merge.
Syntax:
Expand All @@ -155,7 +155,7 @@ Examples:
### .omit
The `omit` method on a map takes a list of keys to omit from the map.
The `omit` method on a map takes a list of keys to remove.
Syntax:
Expand All @@ -175,7 +175,7 @@ Examples:
### .sort
The `sort` method on a list returns the reversed list.
The `sort` method on a list returns a sorted list.
Syntax:
Expand All @@ -195,7 +195,7 @@ Examples:
### .uniq
The `uniq` method on a list returns a list of the unique elements.
The `uniq` method on a list returns a list of unique items.
Syntax:
Expand All @@ -215,7 +215,7 @@ Examples:
### .values
The `values` method on a map returns a list of values.
The `values` method on a map returns a list of items.
Syntax:
Expand Down Expand Up @@ -262,7 +262,7 @@ Examples:
### exists
The `exists` macro checks if there exists at least one element in a list that satisfies a given condition. It returns a boolean value based on the evaluation.
The `exists` macro checks if there is at least one element in a list that satisfies a given condition. It returns a boolean value based on the evaluation.
Syntax:
Expand All @@ -284,7 +284,7 @@ Example:
### exists_one
The `exists_one` macro checks if there exists exactly one element in a list that satisfies a given condition. It returns a boolean value based on the evaluation.
The `exists_one` macro checks if there is exactly one element in a list that satisfies a given condition. It returns a boolean value based on the evaluation.
Syntax:
Expand Down Expand Up @@ -319,7 +319,7 @@ e.filter(x, p)
Where:
- `e` is the list you're filtering.
- `e` is the list you are filtering.
- `x` represents each element of the list.
- `p` is the predicate expression applied to each entry.
Expand All @@ -332,7 +332,7 @@ Examples:
### fold
The `fold` macro is used to combine all elements of a collection, such as a list or a map, using a binary function. It's a powerful tool for aggregating or reducing data.
The `fold` macro combines all elements of a collection, such as a list or a map, using a binary function. It's a powerful tool for aggregating or reducing data.
Syntax:
Expand Down Expand Up @@ -413,7 +413,7 @@ Syntax:
e.map(x, t)
// Where:
// `e` is the list you're transforming.
// `e` is the list you are transforming.
// `x` represents each element of the list.
// `t` is the transformation function applied to each entry.
```
Expand Down Expand Up @@ -441,7 +441,7 @@ Examples:
### or
If the value on the left-hand side is none-type, the optional value on the right hand side is returned. If the value on the left-hand set is valued, then it is returned. This operation is short-circuiting and will only evaluate as many links in the `or` chain as are needed to return a non-empty optional value.
If the value on the left-hand side is none-type, the optional value on the right hand side is returned. If the value on the left-hand set is valued, then it is returned. This operation is short-circuiting and evaluates as many links in the `or` chain as are needed to return a non-empty optional value.
```javascript
obj.?field.or(m[?key]) // if obj.field is none, m.key is returned
Expand All @@ -452,24 +452,24 @@ l[?index].or(obj.?field.subfield).or(obj.?other) // first non-none of l[index],
### orValue
When creating map or list, if a field may be optionally set based on its presence, then placing a `?` before the field name or key will ensure the type on the right-hand side must be optional(T) where T is the type of the field or key-value.
When creating map or list, if a field may be optionally set based on its presence, then placing a `?` before the field name or key ensures the type on the right-hand side must be optional(T) where T is the type of the field or key-value.
```javascript
// The following returns a map with the key expression set only if the subfield is present, otherwise a default value is returned
{'a': 'x', 'b': 'y', 'c': 'z'}.?c.orValue('empty') // Returns z since `c` exists
{'a': 'x', 'b': 'y'}.?c.orValue('empty') // Returns 'empty' since `c` does not exist
{'a': 'x', 'b': 'y'}.?c.orValue('empty') // Returns 'empty' since `c` doesn't exist
// We can use the same for list types
[1, 2, 3][?2].orValue(5) // Return 3 since 2nd index has a value
[1, 2][?2].orValue(5) // Return 5 since 2nd index does not exist
[1, 2][?2].orValue(5) // Return 5 since 2nd index doesn't exist
```
### size
`size` function determines the number of elements in a collection or the number of Unicode characters in a string.
`size` determines the number of elements in a collection or the number of Unicode characters in a string.
Syntax
Expand All @@ -489,7 +489,7 @@ b"abc".size() // 3
### slice
Returns a new sub-list using the indexes provided.
Returns a new sub-list using the indices provided.
```javascript
[1, 2, 3, 4].slice(1, 3) // return [2, 3]
Expand Down Expand Up @@ -534,11 +534,7 @@ sets.contains([1, 2.0, 3u], [1.0, 2u, 3]) // true
### sets.equivalent
Returns whether the first and second list are set equivalent. Lists are set
equivalent if for every item in the first list, there is an element in the
second which is equal. The lists may not be of the same size as they do not
guarantee the elements within them are unique, so size does not factor into
the computation.
Returns whether the first and second list are set equivalent. Lists are set equivalent if for every item in the first list, there is an element in the second which is equal. The lists may not be of the same size as they do not guarantee the elements within them are unique, so size doesn't factor into the computation.
sets.equivalent(list(T), list(T)) -> bool
Expand All @@ -562,9 +558,7 @@ sets.equivalent([1, 2, 3], [3u, 2.0, 1]) // true
### sets.intersects
Returns whether the first list has at least one element whose value is equal
to an element in the second list. If either list is empty, the result will
be false.
Returns whether the first list has at least one element whose value is equal to an element in the second list. If either list is empty, the result is false.
```javascript
sets.intersects([1], []) // false
Expand Down Expand Up @@ -1011,8 +1005,8 @@ separating them with an OS specific Separator. Empty elements
are ignored. The result is Cleaned. However, if the argument
list is empty or all its elements are empty, Join returns
an empty string.
On Windows, the result will only be a UNC path if the first
non-empty element is a UNC path addict.
On Windows, the result is only a UNC path if the first
non-empty element is a UNC path.
```javascript
filepath.Join(["/home/flanksource", "projects", "gencel"]; // /home/flanksource/projects/gencel
Expand Down Expand Up @@ -1710,7 +1704,7 @@ regexp.Split("z", -1, "hello") // ["hello"]
### .abbrev
`abbrev` on a string abbreviates the string using ellipses. This will turn the string "Now is the time for all good men" into "...s the time for..."

Check warning on line 1706 in canary-checker/docs/scripting/cel.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] canary-checker/docs/scripting/cel.mdx#L1706

[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.
Raw output
{"message": "[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.", "location": {"path": "canary-checker/docs/scripting/cel.mdx", "range": {"start": {"line": 1706, "column": 66}}}, "severity": "WARNING"}
This function works like `Abbreviate(string, int)`, but allows you to specify a "left edge" offset. Note that this left edge is not
This function works like `Abbreviate(string, int)`, but allows you to specify a "left edge" offset. The left edge is not
necessarily going to be the leftmost character in the result, or the first character following the ellipses, but it will appear

Check warning on line 1708 in canary-checker/docs/scripting/cel.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] canary-checker/docs/scripting/cel.mdx#L1708

[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.
Raw output
{"message": "[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.", "location": {"path": "canary-checker/docs/scripting/cel.mdx", "range": {"start": {"line": 1708, "column": 117}}}, "severity": "WARNING"}
somewhere in the result.
In no case will it return a string of length greater than maxWidth.

Check warning on line 1710 in canary-checker/docs/scripting/cel.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] canary-checker/docs/scripting/cel.mdx#L1710

[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.
Raw output
{"message": "[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.", "location": {"path": "canary-checker/docs/scripting/cel.mdx", "range": {"start": {"line": 1710, "column": 12}}}, "severity": "WARNING"}
Expand Down Expand Up @@ -1796,7 +1790,7 @@ The valid formatting clauses are:
- `%s` substitutes a string. This can also be used on `bools`, `lists`, `maps`, `bytes`,
`Duration`, `Timestamp`,`int`, `double`
<br/>Note that the dot/period decimal separator will always be used when printing a list or map that contains a double, and that null can be passed (which results in the string "null") in addition to types.
<br/>the dot/period decimal separator will always be used when printing a list or map that contains a double, and that null can be passed (which results in the string "null") in addition to types.

Check warning on line 1793 in canary-checker/docs/scripting/cel.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] canary-checker/docs/scripting/cel.mdx#L1793

[Flanksource.ProfanityUnlikely] Be careful with 'period', it's profane in some cases.
Raw output
{"message": "[Flanksource.ProfanityUnlikely] Be careful with 'period', it's profane in some cases.", "location": {"path": "canary-checker/docs/scripting/cel.mdx", "range": {"start": {"line": 1793, "column": 16}}}, "severity": "WARNING"}

Check warning on line 1793 in canary-checker/docs/scripting/cel.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] canary-checker/docs/scripting/cel.mdx#L1793

[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.
Raw output
{"message": "[Flanksource.FutureTense] Use present tense verbs, not future tense verbs like 'will'. Say '(event) happens' instead of '(event) will happen'.", "location": {"path": "canary-checker/docs/scripting/cel.mdx", "range": {"start": {"line": 1793, "column": 41}}}, "severity": "WARNING"}
- `%d` substitutes an integer.
- `%f` substitutes a double with fixed-point precision. The default precision is 6, but this can be adjusted. The strings `Infinity`, `-Infinity`, and `NaN` are also valid input for this clause.
- `%e` substitutes a double in scientific notation. The default precision is 6, but this can be adjusted.
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/scripting/gotemplate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Decode a Base64 string. This supports both standard ([RFC4648 &sect;4](https://t
```

:::note
For the functions that return an array, a Go `[]interface{}` is returned, regardless of whether or not the input was a different type.
For the functions that return an array, a Go `[]interface{}` is returned, regardless of whether the input was a different type.
:::

## Collection
Expand Down
5 changes: 5 additions & 0 deletions fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash


vale --output=JSON $1 > vale.json
aider --no-git $1 vale.json -m "As a technical editor for developer tool documentation, Fix any issues detected in $1 by using the scan results in vale.json, do not make changes to anything quoted using \` or \`\`\`. do not remove '//' if found at the start of a line or in the middle of a line. Do not modify any whitespace. Only modify the content based on suggestions in vale.json. DO not modify lines that start with '{{' or lines that look like code. Only modify english sentances. Stop after 20 fixes"
21 changes: 21 additions & 0 deletions styles/ignore/words-with-suggestions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,24 @@ Youtube
yq
CRD's
Zulip
HTTPConnection
scheduleTimeout
expectedContent
expectedHttpStatuses
readyTimeout
scheduleTimeout
httpTimeout
deleteTimeout
ingressTimeout
deadline
httpRetryInterval
ingressName
ingressHost
priorityClass
handshakeTimeout
tlsConfig
templateBody
responseCodes
responseContent
thresholdMillis
maxSSLExpiry

0 comments on commit c6418b1

Please sign in to comment.