cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/checks/rule/name.md
109lines · modecode
| 1 | --- |
| 2 | layout: default |
| 3 | parent: Checks |
| 4 | grand_parent: Documentation |
| 5 | --- |
| 6 | |
| 7 | # rule/name |
| 8 | |
| 9 | This check allows to match rule names: |
| 10 | |
| 11 | - `alert` for alerting rules |
| 12 | - `record` for recording rules |
| 13 | |
| 14 | ## Configuration |
| 15 | |
| 16 | Syntax: |
| 17 | |
| 18 | ```js |
| 19 | name "$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 | |
| 33 | This check is not enabled by default as it requires explicit configuration |
| 34 | to work. |
| 35 | To enable it add one or more `rule {...}` blocks and specify all required |
| 36 | labels there. |
| 37 | |
| 38 | Example that will require all recording rules to have `rec:` prefix: |
| 39 | |
| 40 | ```js |
| 41 | rule { |
| 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 | |
| 55 | You can disable this check globally by adding this config block: |
| 56 | |
| 57 | ```js |
| 58 | checks { |
| 59 | disabled = ["rule/name"] |
| 60 | } |
| 61 | ``` |
| 62 | |
| 63 | You can also disable it for all rules inside given file by adding |
| 64 | a comment anywhere in that file. Example: |
| 65 | |
| 66 | ```yaml |
| 67 | # pint file/disable rule/name |
| 68 | ``` |
| 69 | |
| 70 | Or you can disable it per rule by adding a comment to it. Example: |
| 71 | |
| 72 | ```yaml |
| 73 | # pint disable rule/name |
| 74 | ``` |
| 75 | |
| 76 | If you want to disable only individual instances of this check |
| 77 | you can add a more specific comment. |
| 78 | |
| 79 | ```yaml |
| 80 | # pint disable rule/name($pattern) |
| 81 | ``` |
| 82 | |
| 83 | Example pint rule: |
| 84 | |
| 85 | ```js |
| 86 | name "rec:.+" { |
| 87 | comment = "ALl recording rules must use the `rec:` prefix." |
| 88 | severity = "bug" |
| 89 | } |
| 90 | ``` |
| 91 | |
| 92 | Example comment disabling that rule: |
| 93 | |
| 94 | ```yaml |
| 95 | # pint disable rule/name($rec:.+$) |
| 96 | ``` |
| 97 | |
| 98 | ## How to snooze it |
| 99 | |
| 100 | You 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 | |
| 106 | Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) |
| 107 | formatted or `YYYY-MM-DD`. |
| 108 | Adding this comment will disable `rule/name` _until_ `$TIMESTAMP`, after that |
| 109 | check will be re-enabled. |