Skip to content

Commit

Permalink
chore: added analyse docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufhm committed Feb 13, 2025
1 parent 8ad154b commit 39b2383
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 21 deletions.
1 change: 1 addition & 0 deletions docs/src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ module.exports = {
['/reference/analyse/equals', 'equals'],
['/reference/analyse/not-empty', 'not:empty'],
['/reference/analyse/regex-match', 'regex:match'],
['/reference/analyse/regex-not-match', 'regex:not-match'],
]
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/src/reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The following Analyse plugins are available:
- [equals](../reference/analyse/equals)
- [not:empty](../reference/analyse/not-empty)
- [regex:match](../reference/analyse/regex-match)
- [regex:not-match](../reference/analyse/regex-not-match)

## Remediation plugins

Expand Down
32 changes: 18 additions & 14 deletions docs/src/reference/analyse/allowed-list.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# allowed:list

The `allowed:list` plugin checks if values are allowed for a number of input formats.
The `allowed:list` analyser checks if values in a list or map match against a list of allowed values. It can also enforce required values and flag deprecated values.

## Plugin fields
## Configuration

::: warning
TODO: Add details on how the logic works.
:::
| Field | Type | Required | Description |
| ------------- | -------- | -------- | ---------------------------------------------------------- |
| allowed | []string | No | List of allowed values |
| required | []string | No | List of values that must be present |
| deprecated | []string | No | List of deprecated values to flag |
| exclude-keys | []string | No | For map inputs, keys to exclude from validation |
| ignore | []string | No | List of values to ignore during validation |
| package-match | string | No | If set, treats values as packages and matches package names |

| Field | Description | Required | Default |
| ------------- | ------------------------------ | :------: | :-----: |
| package-match | The package to match against. | No | "" |
| allowed | The list of allowed values. | No | [] |
| required | The list of required values. | No | [] |
| deprecated | The list of deprecated values. | No | [] |
| exclude-keys | The list of keys to exclude. | No | [] |
| ignore | The list of values to ignore. | No | [] |
<Content :page-key="$site.pages.find(p => p.path === '/reference/common/analyse.html').key"/>

## Supported Input Formats

- `FormatListString`: Validates each string in the list
- `FormatMapString`: Validates each value in the map
- `FormatMapListString`: Validates each string in the lists contained in the map

## Example Usage

<Content :page-key="$site.pages.find(p => p.path === '/reference/common/analyse.html').key"/>
21 changes: 14 additions & 7 deletions docs/src/reference/analyse/equals.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# equals

The `equals` plugin checks if a value is exactly equal to an input.
The `equals` analyser checks if a value equals a given string. For map inputs, it checks if the value at a specified key equals the given string.

## Plugin fields

| Field | Description | Required | Default |
| ----- | -------------------------------------------------------------- | :------: | :-----: |
| value | The value to compare against. | Yes | "" |
| key | A key to look up the value when the input is a map of strings. | No | [] |
## Configuration

| Field | Type | Required | Description |
| ------- | ------ | -------- | ------------------------------------------------ |
| value | string | Yes | The string value to compare against |
| key | string | No | For map inputs, the key whose value to check |

<Content :page-key="$site.pages.find(p => p.path === '/reference/common/analyse.html').key"/>

## Supported Input Formats

- `FormatString`: Checks if the string value equals the configured value
- `FormatMapString`: Checks if the value at the specified key equals the configured value

## Example Usage

13 changes: 13 additions & 0 deletions docs/src/reference/analyse/not-empty.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# not:empty

The `not:empty` analyser checks if a map contains any values. This is useful for ensuring configuration sections are populated.

## Configuration

No additional configuration is required beyond the common analyser fields.

<Content :page-key="$site.pages.find(p => p.path === '/reference/common/analyse.html').key"/>

## Supported Input Formats

- `FormatMapNestedString`: Checks if the nested map contains any values

## Example Usage

18 changes: 18 additions & 0 deletions docs/src/reference/analyse/regex-match.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# regex:match

The `regex:match` analyser checks if a value matches a given regular expression pattern. This is useful for validating that configuration values follow certain patterns.

## Configuration

| Field | Type | Required | Description |
| ------- | ------ | -------- | ------------------------------------------------ |
| pattern | string | Yes | The regular expression pattern that should match |


<Content :page-key="$site.pages.find(p => p.path === '/reference/common/analyse.html').key"/>

## Supported Input Formats

- `FormatNil`: No validation performed
- `FormatMapNestedString`: Checks all nested string values against the pattern
- `FormatString`: Checks the string value against the pattern

## Example Usage

20 changes: 20 additions & 0 deletions docs/src/reference/analyse/regex-not-match.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# regex:not-match

The `regex:not-match` analyser checks if a value does NOT match a given regular expression pattern. This is useful for ensuring certain patterns are absent from your configuration.

## Configuration

| Field | Type | Required | Description |
| ------- | ------ | -------- | ---------------------------------------------------- |
| pattern | string | Yes | The regular expression pattern that should NOT match |


<Content :page-key="$site.pages.find(p => p.path === '/reference/common/analyse.html').key"/>

## Supported Input Formats

- `FormatNil`: No validation performed
- `FormatMapNestedString`: Checks all nested string values against the pattern
- `FormatString`: Checks the string value against the pattern

## Example Usage

0 comments on commit 39b2383

Please sign in to comment.