Page kind: Reference
swarmops check lint#
Report what a tree's check file names that cannot work, without running anything.
Reads .swarmops/checks.toml at REV (default main) as check list reads it, or the files below DIR with --dir, and looks at what each check names: a need that is no check of the file, or is not of every stage the check is of (check run would refuse it); an input pattern that matches no path of the tree (a pattern that names a directory matches nothing); a dir that is no directory of the tree. No fault is exit 0. A fault is E_CHECK_FILE with details.reason lint, the first fault's line and key, and every fault, ordered by check, kind and value, in details.lint (at most 1,000, the rest counted); the message counts them and names the first three. A file that does not read, or whose checks need one another in a circle, is refused as check list refuses it. --dir reads the host's files, follows no link and says vouched. Reads only: no identity, no lock, nothing is run.
- Group
checks- Since
0.14.0- Mutates
- no
- Identity required
- no
- MCP tool
check_lint- Envelope op
check_lint- Exit codes
- 01
- Errors
- E_CHECK_FILE
Syntax#
swarmops check lint [OPTIONS] [REV]Required arguments#
None.
Optional arguments#
The command also takes the global options.
Syntax: <REV>.
The changeset whose tree's checks to lint.
Syntax: --dir <DIR>.
Read the check file and the tree below DIR on this host, not from the store.
Examples#
swarmops --repo [tmp]/store check lintShow 14 more lines
"version":Exit code 0. Recorded by the CLI tests. A name in square brackets, such as [tmp] or [c1], stands for what differs from run to run: the test's temporary directory, an id, a time.
No recorded example yet.
Details#
check lint says what a tree's check file names that cannot work. It reads the file as
check list reads it, then looks at what each check names, and runs
nothing: it takes no identity and no lock, and writes nothing. It is the check a gate can make of
its own check file with no parsing: no fault is exit 0, any fault is exit 1.
Two forms#
- From the store,
check lint [REV]: the tree ofREV(defaultmain), resolved once and recorded inmeta.resolved; the answer names thattreeand saysvouched: false. - From a directory,
check lint --dir DIR: the check file and the files belowDIRon this host. It opens no store, so--repo,SWARMOPS_REPOand--asare not used, and the envelope has nometa.repo. The answer saysvouched: true; no entry of the directory is followed if it is a symbolic link, and.gitand.swarmwsare no part of the tree.REVand--dirtogether are a usage error.
What it looks at#
| Kind | A fault when | key | value |
|---|---|---|---|
need_undefined | A need names no check of the file. | check.<name>.needs | The need. |
need_off_stage | A need is a check of the file, but not of every stage the check that names it is of: check run of one of those stages refuses the run. | check.<name>.needs | The need. |
input_matches_nothing | An input pattern matches no entry of the tree. A pattern that names a directory exactly matches nothing, and a link is matched by its own path. | check.<name>.inputs | The pattern. |
dir_missing | A check's dir is no directory of the tree (a link is none). The root, ., always is. | check.<name>.dir | The directory. |
Each fault carries the check it is of and the line its table starts on. The faults come
ordered by check name, then by kind in the order of the table, then by value, at most 1,000 of
them: the rest are counted in faults_omitted. A file that does not read is refused as
check list refuses it (E_CHECK_FILE, with the reason it gives), and so are checks that need
one another in a circle (cycle); neither is a fault of the kinds above.
The answer#
No fault: the result holds vouched, the tree (the store form), the file and version read,
how many checks it looked at and an empty faults; exit 0. A tree with no check file has no
check and no fault.
Any fault: E_CHECK_FILE, exit 1, not retryable, details.reason lint. details.file and
details.vouched say what was read, details.line and details.key are the first fault's, and
details.lint is the whole result, the one the clean answer would have been, with its faults.
The message counts the faults and names the first three, so --human prints what to fix; the
hint says where the rest are.
In the gate#
just check runs check lint --dir . with the build under test, after check list --dir ., so
that a need or a pattern that names nothing fails the gate with its line in the log. The CI job
that runs check run uses a pinned released build, which reads the file without the keys that
build does not know, so this repository's file declares none of inputs or needs until that
build holds them.
Return information#
result is a CheckLintResp (swarmops schema CheckLintResp prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
checks | integer | yes | How many checks the file defines. |
faults | array of CheckLintFaultOut | yes | What cannot work, at most 1,000 of them: ordered by check name, then by kind (need_undefined, need_off_stage, input_matches_nothing, dir_missing), then by value. |
faults_omitted | integer | no | The faults past the 1,000 returned, counted. Omitted when 0. |
file | string or null | no | The file the checks came from, as check list names it. Omitted when the tree holds no check. |
tree | string or null | no | The root tree the file was read from: 64 hex digits. Omitted for a directory. |
version | integer or null | no | The check file's version, 1. Omitted unless file is .swarmops/checks.toml. |
vouched | boolean | yes | Whether only the caller stands behind the file: true when it was read from a directory the caller named (check lint --dir); false when it was read from the store, at tree. |
Envelope op: check_lint.
Exit codes:
0: Success.1: The operation failed.
Errors#
- E_CHECK_FILE (exit 1): A check file does not read, or cannot work:
.swarmops/checks.toml(or, in a tree without one,.swarmops/workspaces.json) is too large, not text, not a file, not TOML (JSON), not version 1, holds a key, a name or a value version 1 does not take, has checks that need one another in a circle (details.cycle), or is one whose need a run cannot satisfy (details.check,details.need,details.stage):details.file,details.reason,details.vouched, anddetails.lineanddetails.keywhen known.
Any command that opens a store may also fail with a store error, such as E_NOT_A_REPO, E_IO or E_STORE_CORRUPT; a command line the grammar refuses is E_INVALID_ARG (exit 2).