context.has
Require the text to mention values supplied by the run's context (a branch, a ticket, a version).
Science officer: Fascinating claim. Source?
needs context What to pass
Quick reference
| Written as | Fails with | Applies to |
|---|---|---|
context. | missing-context-value errorcontext-value-missing error | section |
Examples
context. has
Require the section body to contain the string value of context.values.<key>, supplied via --context. A run without that key could not check the document (missing-context-value); a trailing ? (context.has=packageVersion?) makes that a note and the rule skips.
A section that states the context version passes
<!-- mdv: section context.has=packageVersion -->
## Changelog
<!-- mdv: endsection -->{ "values": { "packageVersion": "0.2.0" } }## Changelog
Released 0.2.0.✓ passes
A section that states a different version is flagged
<!-- mdv: section context.has=packageVersion -->
## Changelog
<!-- mdv: endsection -->{ "values": { "packageVersion": "0.2.0" } }## Changelog
Released 0.1.9.✗ context-value-missing error · line 3
A run with no context value could not check the document
<!-- mdv: section context.has=packageVersion -->
## Changelog
<!-- mdv: endsection -->## Changelog
Released 0.2.0.✗ missing-context-value error