Relix

Programming guide

relix check

Analyses scripts without running them, and reports what is wrong with them on standard error as FILE:LINE:COL: severity: message.

find . -name '*.relix' -print0 | xargs -0 relix check

Usage

relix check [OPTIONS] [SCRIPT...]

Arguments

ArgumentDescription
SCRIPT...Script files, each run in a session of its own; - is standard input. With neither -e nor SCRIPT, standard input is read when it is not a terminal.

Options

OptionDescription
-e, --expr=TEXTRelix text to run. Repeatable: the texts are one script, in order. A bare relational expression runs as a query.
-i, --input=NAME=[FORMAT:]LOCATIONBind the relation NAME to a file, an http(s) URL (with --remote), or - for standard input. FORMAT is csv, tsv, json or ndjson; without it the extension decides, and standard input must name one. Repeatable.
--schema=NAME={...}The heading of the input NAME, such as NAME='{ id: NUMBER, name: STRING }', instead of inferring one.
--infer-rows=NInfer an input's heading from its first N records (default: 1000).
--unbounded=NAMEThe input NAME never ends, as tail -f's does: its rows stream as they arrive, and a query that would have to read all of it first is refused. Repeatable.
--jsonWrite the diagnostics to standard output as one JSON document instead.

It also takes the global options.

Exit status

StatusMeaning
0every script analyses
3a script does not parse or analyse

Examples

A script that analyses prints nothing, and exits 0:

relix check scripts/top-customers.relix

A problem is printed on standard error, and the status is 3:

shell
relix check scripts/broken.relix 2>&1; echo "exit $?"
Result
scripts/broken.relix:1:30: error: Undefined relation: 'Ordrs'
exit 3

--json writes the diagnostics to standard output instead, as one document for a tool to read:

shell
relix check --json scripts/broken.relix; echo "exit $?"
Result
{"diagnostics":[{"file":"scripts/broken.relix","line":1,"column":30,"severity":"error","message":"Undefined relation: 'Ordrs'"}]}
exit 3

Pipelines checks every script in a tree.