rule-under-strict
Tests how a rule is read and applied: severity, scope, options and switching rules off.
Our implementation passes this case when its check --json output for the input below equals the expected
output.
Input
nodes/a.md---
id: a
type: svc
---nodes/b.md---
id: b
type: svc
parent: a
---nodes/c.md---
id: c
type: svc
parent: b
---nodes/r.md---
id: r
type: rule
fields:
statement: s
applies_to: {under: a}
check: {require_fields: [zz]}
---Expected output
0 ghosts · 0 load errors · 4 nodes · 2 results
expected.json{
"ghosts": [],
"load_errors": [],
"nodes": [
{
"body": "",
"fields": {},
"id": "a",
"links": [],
"parent": null,
"plane": null,
"title": "a",
"type": "svc"
},
{
"body": "",
"fields": {},
"id": "b",
"links": [],
"parent": "a",
"plane": null,
"title": "b",
"type": "svc"
},
{
"body": "",
"fields": {},
"id": "c",
"links": [],
"parent": "b",
"plane": null,
"title": "c",
"type": "svc"
},
{
"body": "",
"fields": {
"applies_to": {
"under": "a"
},
"check": {
"require_fields": [
"zz"
]
},
"statement": "s"
},
"id": "r",
"links": [],
"parent": null,
"plane": null,
"title": "r",
"type": "rule"
}
],
"results": [
{
"node": "b",
"rule": "r",
"severity": "warn",
"status": "fail"
},
{
"node": "c",
"rule": "r",
"severity": "warn",
"status": "fail"
}
],
"structure": {
"errors": [],
"warnings": []
}
}