/pre-commit-pint

pre-commit for pint

MIT LicenseMIT

pre-commit

pre-commit-pint

Pre commit checks for linting with pint, which is a brilliant Prometheus rule linter by Cloudflare.

Config

It will automatically pick up the default pint config.

Severity must be set to 'fatal' or 'bug' for pint lint to return a non-zero exit code, thus failing the check.

Example .pint.hcl

# Allows parsing k8s manifests directly
parser {
  relaxed = [ "(.*)" ]
}

rule {
  # This block will apply to all alerting rules with severity="critical" label set.
  match {
    kind = "alerting"

    label "severity" {
      value = "critical"
    }
  }

  # All severity="critical" alerts must have a runbook link as annotation.
  annotation "runbook" {
    severity = "bug"
    value    = "https://runbook.example.com/.+"
    required = true
  }
}