Skip to content

chant workspace lint

llms.txt lists every page for an agent
chant workspace lint [dir] [--format stylish|json|sarif] [-o <file>] [--member <name>] [--fix] [--cross-root [--env <env>]] [--dry-run [--json]]

chant workspace lint runs chant lint . inside every member of kind chant and every project an example group matches, each under the member’s own chant (#2537, ws-026). Each member is linted with the rules and lexicon versions it would use on its own. The members to run, the toolchain each one gets and the one process per toolchain work as described for chant workspace build.

The root member . is linted without the other members’ directories and the group matches, as chant lint --root-only lints it.

With the default stylish format, each project’s own lint output is printed under a heading, and a summary line goes to stderr.

With --format sarif, the output is one SARIF 2.1.0 log with one run per member. Each run is what the member’s chant lint --format sarif printed, with three changes:

  • automationDetails.id is <member>/, or <group>:<dir>/ for an example project, which is how SARIF tells runs of one tool apart. GitHub code scanning shows it as the category.
  • properties gains member and dir.
  • Artifact URIs are made relative to the workspace root.

A member whose lint printed no SARIF gets a run with no results and a failed invocation carrying its exit code and the end of its stderr.

{
"version": "2.1.0",
"runs": [
{
"tool": { "driver": { "name": "chant", "rules": [] } },
"automationDetails": { "id": "api/" },
"properties": { "member": "api", "dir": "services/api" },
"results": [
{
"ruleId": "COR004",
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "services/api/src/infra.ts" } } }]
}
]
}
]
}

With --format json, the output is { "workspace", "members", "skipped" }. Each entry in members names the member and its directory, and holds the member’s exit code and the diagnostics array its own chant lint --format json printed.

A member link is written down once, on the consumer, and the members’ graphs can surface the same relation on their own. --cross-root also reports where the two disagree (#2549). It is off by default, so a plain workspace lint costs nothing more.

It uses the cross-build-root mode of post-synth checks (#1939). Every chant member’s graph is read under its own toolchain, as chant workspace graph reads it. Each composed member becomes one root, and the composed graph’s link table is handed to every check. Two kinds of check run:

  • LNK001, chant’s own. It warns when a consumer declares a link to one member’s output while its graph joins a parameter of the same name (joinKey) to another member’s output.
  • The cross-root checks each lexicon ships through its plugin’s crossRootChecks(), for every lexicon the members’ graphs name. A lexicon applies its own disagreement rules once it surfaces the relation in its IR. A lexicon whose checks can’t be loaded from the workspace root’s install is listed and skipped.
── cross-root (LNK001; 1 finding)
warning LNK001 [api] api declares a link to legacy-net's output vpcId, but its graph joins parameter vpcId to network's output VpcId. Point the link at the member the graph reads from, or rename the parameter so it joins the declared output.

With --format json the document gains crossRoot: { findings, checks, unloaded }, and with --format sarif the log gains one run whose automationDetails.id is cross-root/. A finding at error severity fails the command, and so does a graph that can’t be read. LNK001 itself only warns.

OptionEffect
dirWhere the walk up to the declaration starts.
--format stylish|json|sarifThe output format, and the format each member is asked for.
-o, --output <file>Write the json or sarif document to a file.
--member <name>Run only these members or example groups. Repeatable, and a comma list works too.
--fix, --param <name=value>, --params-file <path>Passed to each member’s lint.
--cross-rootAlso run the disagreement lint over every member’s graph. --env <env> names the environment the checks see.
--dry-runPrint the plan and lint nothing.
CodeMeaning
0No project’s lint found errors.
1A project’s lint found errors or failed, a chant member couldn’t be read, or the declaration couldn’t be read.
Terminal window
# Lint every member and example project
chant workspace lint
# One SARIF log for code scanning, one run per member
chant workspace lint --format sarif -o results.sarif

chant