Skip to content

gunnaringe/pre-commit-pint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  }
}