Check, fix, format
zz check
Section titled “zz check”zz checkzz check src/main.zzzz check src/zz check --stats src/main.zz # modules, cache hits, seed size, wall timezz check --format json # machine diagnostics, exit codes unchangedFlags: --fix/-f safe fixes, --hard all incl. ambiguous, --interactive/-i
prompt for ambiguous. zz check --check is rejected — use zz fmt --check.
Cold single file is ~40ms; warm is cache-served (0 checked). Budget: p50 ≤0.5s
on 10k-line cold, ≤50ms warm per file. Verify with --stats twice (second shows cached).
zz fix
Section titled “zz fix”Shortcut for zz check --fix:
zz fix src/zz fix --hard src/zz fmt
Section titled “zz fmt”zz fmtzz fmt src/main.zzzz fmt -c src/ # dry run, exit 1 if changedzz fmt src/The formatter never drops a comment. A comment inside a literal, a field list, an argument list, a tuple, a match arm or an enum variant keeps its place:
xs := [ 1, // first 2, // second]A list that carries a comment is written one item per line; a comment
that sat on the item’s line stays there, a comment that sat on a line of
its own keeps that line. A comment in a position the formatter cannot
model (an if condition, for example) keeps the surrounding statement
as it was written. Formatting is idempotent: formatting a formatted file
changes nothing.
Diagnostics shape
Section titled “Diagnostics shape”error[E001]: type mismatch --> src/main.zz:5:12 | 5 | x: int = "hello" | ---- ^^^^^^^^ expected int, found str | = help: cast string to int with `int()` functionEvery pass reports all errors, not just the first. Source context + span +
code + help. Warnings (W001 unused var) carry = fix: lines zz fix applies.
File loading: std.* from stdlib, .name from current dir,
utils.helper relative to importer, <pkg>.path to <root>/src/path.zz
from anywhere (incl. tests/ → src/). Precedence std > package > registry >
relative. Circular imports error with a restructure hint (extract shared c.zz).
One file under several namespaces composes (first wins canonical); two files
under one namespace stay an error.
Common fixes: see Error catalog.