PPROLint

Conditions

Compare fields with values, combine conditions and handle unknown values.

A condition decides whether an item is reported. It is a comparison, or a combination of conditions.

Comparisons

A comparison names a field, an operator and, for most operators, a value:

{ "field": "clip.scale", "operator": "greaterThan", "value": 120 }

The value is a literal (a number, a string or a boolean), or a reference to another field, including an option:

{ "field": "clip.scale", "operator": "greaterThan", "value": { "field": "options.max" } }
{ "field": "clip.end", "operator": "lessThanOrEqual", "value": { "field": "sequence.inPoint" } }

Types must match: greaterThan on a string field, or a string value for a number field, is rejected when the rule loads.

Some operators take a particular value:

{ "field": "clip.scale", "operator": "between", "value": [50, 150] }
{ "field": "clip.source.extension", "operator": "in", "value": ["mov", "mxf"] }
{ "field": "marker.name", "operator": "matches", "value": "^Chapter \\d+$" }
{ "field": "clip.source.mediaPath", "operator": "exists" }

between includes its bounds. matches takes a JavaScript regular expression, written as a JSON string (so \d is "\\d"), and matches anywhere unless anchored with ^ and $. exists takes no value. All operators are listed in Operators.

JSON has no infinity: write "Infinity" or "-Infinity" where a number is expected. A silenced audio clip is { "field": "clip.volume", "operator": "equals", "value": "-Infinity" }.

Combinations

{ "all": [ /* conditions */ ] }
{ "any": [ /* conditions */ ] }
{ "not": /* condition */ }
  • all holds when every condition in it holds (and).
  • any holds when at least one does (or).
  • not inverts one condition.

They nest freely. Each combination object holds exactly one of these keys.

An enabled video clip scaled outside 50–150 %
{
  "all": [
    { "field": "clip.trackType", "operator": "equals", "value": "video" },
    { "field": "clip.disabled", "operator": "equals", "value": false },
    {
      "any": [
        { "field": "clip.scale", "operator": "lessThan", "value": 50 },
        { "field": "clip.scale", "operator": "greaterThan", "value": 150 }
      ]
    }
  ]
}

Unknown values

Some fields can be unknown: their type ends in ? in the fields reference. An audio clip has no scale; a clip without source media has no media path.

Every comparison is false when its field, or a field it refers to, is unknown, except exists and notExists. So clip.scale lessThan 50 does not report audio clips, and neither does clip.scale notEquals 100.

The trap: not

not turns a false comparison into true. { "not": { "field": "clip.scale", "operator": "equals", "value": 100 } } does match every audio clip, since their scale is unknown.

When a rule needs a known value, say so:

  • prefer positive comparisons, lessThan min or greaterThan max, over not between;
  • or add { "field": "clip.scale", "operator": "exists" } to an all.

Conditions shared by every check

There is no rule-wide filter. When a rule has several checks and each needs the same conditions (an enabled clip, a known value), repeat them in each check.

On this page