Checks
Word different situations differently, report several problems per item, change the scope or position of a check.
Every rule lists its checks, even when there is only one. A check pairs a condition with the message reported when it holds, and optional data merged over the rule's own.
| Property | Required | Meaning |
|---|---|---|
condition | yes | When to report. |
message | yes | What to say. |
data | no | Values attached to this check's diagnostics, merged over the rule's data. |
scope | no | Runs this check on another scope than the rule's. |
location | no | A number field, in ticks, giving the diagnostic's position in the timeline. |
Several checks
A rule that words two situations differently has one check per situation. They are tried in order, and the first whose condition holds gives the item its diagnostic. An item is reported at most once per rule:
"checks": [
{
"condition": { "field": "clip.duration", "operator": "equals", "value": 0 },
"message": "Clip \"{clip.name}\" on {clip.track} has zero duration."
},
{
"condition": { "field": "clip.duration", "operator": "lessThan", "value": 0 },
"message": "Clip \"{clip.name}\" on {clip.track} ends before it starts."
}
],
"data": { "durationTicks": "clip.duration" }Since the first check that holds wins, put the most specific one first.
One diagnostic per check: matching
With "matching": "all" at the top of the rule file, every check that holds reports, so one item can get several diagnostics. Use it when the checks describe independent problems, and make sure they exclude each other where they should.
The built-in Subframe video edits rule does this: a clip is reported for its start, its end, or both.
"matching": "first", the default, is the behavior above.
A check on another scope
A check may set its own scope when one rule reports on items of different kinds. Its condition, message and data then read the fields of that scope. The rule's shared data must be valid in the scope of every check.
Subframe video edits has clip checks and sequence checks: the sequence's in and out points are reported apart from the clips.
Where the diagnostic points
Each scope gives its diagnostics a default position: the start of the clip or the marker. Tracks and the sequence have none. Set location to a number field, in ticks, to choose it. The built-in Muted tracks rule points at the track's first clip (simplified here):
{
"condition": { "field": "track.muted", "operator": "equals", "value": true },
"message": "Track {track.ref} is muted.",
"location": "track.firstClipStart"
}