# occurrence

Learn about the occurrence extension point.

| Name    | Type     | Description                                                         |
| ------- | -------- | ------------------------------------------------------------------- |
| `max`   | `int`    | The maximum amount of times `token` may appear in a given scope.    |
| `min`   | `int`    | The minimum amount of times `token` has to appear in a given scope. |
| `token` | `string` | The token of interest.                                              |

`occurrence` enforces the maximum or minimum number of times a particular token can appear in a given scope.

```yaml
extends: occurrence
message: 'More than 3 commas!'
level: error
# Here, we're counting the number of times a comma appears
# in a sentence.
#
# If it occurs more than 3 times, we'll flag it.
scope: sentence
max: 3
token: ','
```

In the example above, we’re limiting the number of commas per sentence.

## [message](#message)

The `message` key can contain an optional format specifier `%s` which will be populated with the number of occurrences:

```yaml
message: 'Titles should use fewer than 70 characters (found: %s).'
```

[substitution](/checks/substitution.md) [repetition](/checks/repetition.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vale.sh/checks/occurrence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
