cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.29.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/ignoring.md

100lines · modecode

1---
2layout: default
3title: Ignoring problems
4parent: Documentation
5nav_order: 2
6---
7
8# Ignoring selected lines or files
9
10While parsing files pint will look for special comment blocks and use them to
11exclude some parts or whole files from checks.
12
13## Ignoring whole files
14
15Add a `# pint ignore/file` comment on top of the file, everything below that line
16will be ignored.
17
18Example:
19
20```yaml
21# pint ignore/file
22
23groups:
24 - name: example
25 rules:
26 - record: job:http_inprogress_requests:sum
27 expr: sum by (job) (http_inprogress_requests)
28```
29
30## Ignoring individual lines
31
32To ignore just one line use `# pint ignore/line` at the end of that line or
33`# ignore/next-line` on the line before.
34This is useful if you're linting templates used to generate Prometheus
35configuration and it contains some extra lines that are not valid YAML.
36
37Example:
38
39{% raw %}
40```yaml
41{% set some_jinja_var1 = "bar" %} # pint ignore/line
42groups:
43 - name: example
44 rules:
45 - record: job:http_inprogress_requests:sum
46 expr: sum by (job) (http_inprogress_requests)
47
48# pint ignore/next-line
49{% set some_jinja_var2 = "foo" %}
50```
51{% endraw %}
52
53## Ignoring a range of lines
54
55To ignore a part of a file wrap it with `# pint ignore/begin` and
56`# pint ignore/end` comments.
57
58Example:
59
60{% raw %}
61```yaml
62# pint ignore/begin
63{% set some_jinja_var1 = "bar" %}
64{% set some_jinja_var2 = "foo" %}
65# pint ignore/end
66
67groups:
68 - name: example
69 rules:
70 - record: job:http_inprogress_requests:sum
71 expr: sum by (job) (http_inprogress_requests)
72```
73{% endraw %}
74
75## Disabling checks globally
76
77To disable specific check globally, for all files and rules, add it to pint configuration
78file. Syntax:
79
80```js
81checks {
82 disabled = [ "...", ... ]
83}
84```
85
86Example:
87
88```js
89checks {
90 disabled = ["alerts/template"]
91}
92```
93
94## Disabling individual checks for specific rules
95
96To disable individual check for a specific rule use `# pint disable ...` comments.
97A single comment can only disable one check, so repeat it for every check you wish
98to disable.
99
100See each individual [check](checks/index.md) documentation for details.
101