cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.78.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/checks/rule/name.md

109lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# rule/name
8
9This check allows to match rule names:
10
11- `alert` for alerting rules
12- `record` for recording rules
13
14## Configuration
15
16Syntax:
17
18```js
19name "$pattern" {
20 comment = "..."
21 severity = "bug|warning|info"
22}
23```
24
25- `$pattern` - regexp pattern to match the name on, this can be templated
26 to reference checked rule fields, see [Configuration](../../configuration.md)
27 for details.
28- `comment` - set a custom comment that will be added to reported problems.
29- `severity` - set custom severity for reported issues, defaults to a information.
30
31## How to enable it
32
33This check is not enabled by default as it requires explicit configuration
34to work.
35To enable it add one or more `rule {...}` blocks and specify all required
36labels there.
37
38Example that will require all recording rules to have `rec:` prefix:
39
40```js
41rule {
42 match {
43 kind = "recording"
44 }
45
46 name "rec:.+" {
47 comment = "ALl recording rules must use the `rec:` prefix."
48 severity = "bug"
49 }
50}
51```
52
53## How to disable it
54
55You can disable this check globally by adding this config block:
56
57```js
58checks {
59 disabled = ["rule/name"]
60}
61```
62
63You can also disable it for all rules inside given file by adding
64a comment anywhere in that file. Example:
65
66```yaml
67# pint file/disable rule/name
68```
69
70Or you can disable it per rule by adding a comment to it. Example:
71
72```yaml
73# pint disable rule/name
74```
75
76If you want to disable only individual instances of this check
77you can add a more specific comment.
78
79```yaml
80# pint disable rule/name($pattern)
81```
82
83Example pint rule:
84
85```js
86name "rec:.+" {
87 comment = "ALl recording rules must use the `rec:` prefix."
88 severity = "bug"
89}
90```
91
92Example comment disabling that rule:
93
94```yaml
95# pint disable rule/name($rec:.+$)
96```
97
98## How to snooze it
99
100You can disable this check until given time by adding a comment to it. Example:
101
102```yaml
103# pint snooze $TIMESTAMP rule/name
104```
105
106Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
107formatted or `YYYY-MM-DD`.
108Adding this comment will disable `rule/name` _until_ `$TIMESTAMP`, after that
109check will be re-enabled.