pint.error --no-color -d 'promql/.*' -d alerts/count lint rules
! stdout .
cmp stderr stderr.txt

-- stderr.txt --
level=info msg="Loading configuration file" path=.pint.hcl
level=error msg="Query returned an error" error="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" query=/api/v1/status/config uri=http://127.0.0.1:7108
level=error msg="Query returned an error" error="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" query=/api/v1/status/config uri=http://127.0.0.1:7108
level=error msg="Query returned an error" error="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" query=/api/v1/status/config uri=http://127.0.0.1:7108
level=error msg="Query returned an error" error="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" query=/api/v1/status/config uri=http://127.0.0.1:7108
level=error msg="Query returned an error" error="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" query=/api/v1/status/config uri=http://127.0.0.1:7108
rules/0001.yml:1-2 Bug: duplicated rule, identical rule found at rules/0002.yml:1 (rule/duplicate)
 1 | - record: "colo:duplicate"
 2 |   expr: sum(foo) without(job)

rules/0001.yml:7-8 Bug: couldn't run "labels/conflict" checks due to prometheus "prom" at http://127.0.0.1:7108 connection error: connection refused (labels/conflict)
 7 |   labels:
 8 |     file: a

rules/0001.yml:9-12 Bug: duplicated rule, identical rule found at rules/0002.yml:11 (rule/duplicate)
  9 | - record: "colo:labels:equal"
 10 |   expr: sum(foo) without(job)
 11 |   labels:
 12 |     same: yes

rules/0001.yml:11-12 Bug: couldn't run "labels/conflict" checks due to prometheus "prom" at http://127.0.0.1:7108 connection error: connection refused (labels/conflict)
 11 |   labels:
 12 |     same: yes

rules/0002.yml:5-6 Bug: couldn't run "labels/conflict" checks due to prometheus "prom" at http://127.0.0.1:7108 connection error: connection refused (labels/conflict)
 5 |   labels:
 6 |     empty: nope

rules/0002.yml:9-10 Bug: couldn't run "labels/conflict" checks due to prometheus "prom" at http://127.0.0.1:7108 connection error: connection refused (labels/conflict)
  9 |   labels:
 10 |     file: b

rules/0002.yml:13-14 Bug: couldn't run "labels/conflict" checks due to prometheus "prom" at http://127.0.0.1:7108 connection error: connection refused (labels/conflict)
 13 |   labels:
 14 |     same: yes

level=info msg="Problems found" Bug=7
level=fatal msg="Fatal error" error="found 1 problem(s) with severity Bug or higher"
-- rules/0001.yml --
- record: "colo:duplicate"
  expr: sum(foo) without(job)
- record: "colo:labels:empty"
  expr: sum(foo) without(job)
- record: "colo:labels:mismatch"
  expr: sum(foo) without(job)
  labels:
    file: a
- record: "colo:labels:equal"
  expr: sum(foo) without(job)
  labels:
    same: yes

-- rules/0002.yml --
- record: "colo:duplicate"
  expr: sum(foo) without(job)
- record: "colo:labels:empty"
  expr: sum(foo) without(job)
  labels:
    empty: nope
- record: "colo:labels:mismatch"
  expr: sum(foo) without(job)
  labels:
    file: b
- record: "colo:labels:equal"
  expr: sum(foo) without(job)
  labels:
    same: yes

# pint file/disable rule/duplicate

-- .pint.hcl --
prometheus "prom" {
  uri      = "http://127.0.0.1:7108"
  failover = []
  timeout  = "5s"
  required = true
}
parser {
  relaxed = [".*"]
}
