conformance-checks
Picks the right tool for a convention no linter knows: helm-unittest for rendered Helm charts, conftest with Rego for YAML, JSON, HCL, TOML and Dockerfile, kubeconform for schemas, never a bespoke che
Files1
View on GitHubSKILL.mdskills/quality/conformance-checks/SKILL.md
GitHubConformance checks
Enforce a rule specific to this repository where no linter has an opinion.
When to use
- A convention needs enforcing and no linter covers it.
- A
check-*.shscript exists and should become a declarative check. - Deciding where a new rule belongs.
Rules
- Rendered Helm charts:
helm-unittest. Declarative suites intests/*_test.yamlnext to the chart, withequal,matchRegex,isKindand snapshot assertions. Never render a chart in a script to grep the output. - Structured data, meaning YAML, JSON, HCL, TOML or Dockerfile:
conftestwith Rego policies underpolicy/. The parser follows the file extension,--parserforces one. - A rule spanning files, for example an item in one file must appear in another:
conftest --combineputs every file into one input array for a single policy. - Kubernetes manifest schema validity:
kubeconform, not a hand written rule. - Language style and correctness: the language's own linter, see
lint. - Something only a real validator can judge: invoke that validator directly. Wrapping it in assertions adds nothing.
- No bespoke check runner, no assertion library, no declarative format of our own. A search for an existing tool happens before any of that gets designed.
- One rule per policy or test case. The failure message names the offending element, not the rule text.
- Fixtures and inputs live in files, never inline in the check, so a diff shows whether an input or an expectation changed.
- Keep the policy next to what it guards: chart tests with the chart, repository
policies under
policy/. - Call the check from the task runner so CI and a local run do the same thing.
- A check past roughly one screen means the wrong tool is in use, or the right one was never looked for.
Guardrails
- An existing tool was searched for, and the result is named.
- Chart renders go to
helm-unittest, structured data toconftest. - Cross file rules use
--combine, not a script reading both files. - No new framework, no new assertion language, no check script past one screen.
- Failure messages name the offending element.
- Inputs in files, check called from the task runner.
References
- helm-unittest: https://github.com/helm-unittest/helm-unittest
- conftest: https://www.conftest.dev/
lintfor linter owned rules.