KV001–KV004
Each rule's full reference is also built into the binary, offline: run kv-cli explain KV002, or any other code.
KV001: missing contract parameter
Severity is set per parameter in the contract. In the default contract, target_environment is an error and dry_run is a warning.
What it catches
A governed function that does not declare a parameter the contract requires. The function runs and passes its tests. In production it quietly uses whatever the author's machine assumed, because nothing passes it the target environment.
By default, KV001 covers functions named like deploy*, run_*, *_pipeline, *_job or main, or decorated with @task. A signature a framework owns, such as dbt's def model(dbt, session) or Databricks' @dlt.table, is exempt, because adding a parameter would break the pipeline.
samples/deploy.py 20 error KV001 `deploy_service` is missing contract parameter `target_environment` expected signature to declare `target_environment: str = "dev"` in scope: name matches applies_to.name_patterns "deploy*"
From the kv-cli README
How to fix it
Declare the parameter, then pass it through from the call site. kv-cli fix inserts the parameter with the annotation and default the contract sets, before **kwargs. It changes only the signature, so you still pass the real value at each call site. Airflow's @task is governed but report-only: fix prints a manual: item instead.
How to suppress it
There is no per-line marker for KV001. Exempt the function by name with applies_to.exempt_name_patterns (_* and test_* by default).
KV002: hardcoded credential
Always an error.
What it catches
A credential written into source, a notebook or a config file. kv-cli reports a literal when its shape matches a value pattern (AWS keys, GitHub, Slack, OpenAI, Anthropic, Stripe and Google keys, JWTs, PEM private keys and URLs with a password), or when it is assigned to, or compared with, a name that matches secrets.key_patterns, such as *password* or *token*.
Detector set 2, which kv-cli init writes since 0.15.0, adds Azure Storage account keys inside a connection string, Databricks personal access tokens and SendGrid API keys. A contract without secrets.detectors stays on set 1, so an upgrade doesn't change what it reports or its fingerprint.
samples/deploy.py 11 error KV002 `DB_PASSWORD` is assigned a hardcoded literal value "s3…" (<redacted>, 20 chars) - load it from the environment or a secret store
From the kv-cli README. The value is redacted, so the CI log doesn't leak the credential.
How to fix it
Read the value from the environment or a secret store. kv-cli fix rewrites it to os.environ["NAME"] and adds import os if it is missing. A hardcoded default in a function signature is left as a manual: item, because os.environ[...] in a default is read once, at import time. Afterwards, rotate the credential: a value that was ever committed is still in git history.
How to suppress it
Add a trailing # kovallent:allow-secret comment to the line. JSON has no comments, so exclude a fixture file with scan.exclude instead.
KV003: pinned infrastructure identifier
A warning by default, so turning it on doesn't break CI on day one. Set infrastructure.severity: error to gate on it, or run audit --strict.
What it catches
An identifier that ties code to one environment, such as a warehouse, catalog, bucket, cluster ID, workspace URL, broker or JDBC endpoint. The code works in that one environment and either breaks in the others or, worse, writes to the wrong one.
It applies to Python files, Databricks asset bundles and dbt SQL models. Other config files, dbt's profiles.yml above all, are where environment-specific values belong, so KV003 never applies to them.
samples/frameworks/snowpark_proc.py 16 warning KV003 `account` is pinned to `acme-prod.us-east-1` [snowpark] this should vary by environment - derive it from target_environment
kv-cli v0.16.0, run in the sandbox: kv-cli init then kv-cli audit --strict samples/ on the kv-cli repository's samples/
In dbt SQL models, KV003 reports hardcoded three-part names, USE WAREHOUSE, USE DATABASE, and object-store paths in COPY INTO and after LOCATION. It doesn't check names built in Jinja, hooks, config() arguments, analyses and singular tests, USE SCHEMA, USE ROLE, JDBC URLs, or object-store paths outside COPY and LOCATION.
samples/dbt_sql/models/orders.sql 7 warning KV003 `ANALYTICS_PROD.RAW.ORDERS` is a hardcoded three-part name use {{ ref() }} or {{ source() }}, so the name follows the target
Same sandbox run
How to fix it
Derive the value from the target environment. In SQL, use {{ ref() }} or {{ source() }} for a relation, set the warehouse or database on the dbt target in profiles.yml, and pass paths in with var() or env_var(). kv-cli fix never rewrites these, because the right replacement is a deployment decision.
How to suppress it
Add a trailing # kovallent:allow-infra comment to the line, or -- kovallent:allow-infra in SQL.
KV004: naming convention
Severity is naming.severity, a warning by default. There are no naming rules by default, so KV004 reports nothing until a contract adds one.
What it catches
A Python function whose name doesn't match a naming rule in the contract. pattern is a regex matched against the whole function name. Framework-exempt functions are checked too: a framework owns a function's signature, not its name.
14 warning KV004 `LoadOrders` does not match naming rule `pipeline_functions` name must match `^[a-z][a-z0-9_]*$`: pipeline entrypoints use snake_case
From the KV004 reference
How to fix it
Rename the function, and every caller with it. kv-cli fix never renames a function, because a rename breaks every caller it can't see, so it lists each KV004 finding as a manual: item.
How to suppress it
There is no per-line marker. Exempt the function with applies_to.exempt_name_patterns, which also takes it out of KV001, or narrow the rule with applies_to: in_scope.