Format and check in CI
Lux has exactly one formatting style and a fast static check, which makes CI configuration short.
The three commands
lux-fmt --check . # fails if any file is not canonically formatted
lux check src/ # parse + type-check without running
lux test # run test blocks in .lux files
Example: GitHub Actions
jobs:
lux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build toolchain
run: |
cargo build --release -p lux-cli -p lux-fmt
echo "$PWD/target/release" >> $GITHUB_PATH
- run: lux-fmt --check .
- run: lux check src/
- run: lux test
Why the formatter is trustworthy
lux-fmt has no configuration — there is nothing to debate and no drift
between machine-generated and hand-written code. Its round-trip is
property-tested to a fixed point (parse → emit → parse → emit is idempotent),
so the canonical form is stable: formatting twice never differs from
formatting once.
What lux check catches
- Syntax errors with line/column diagnostics
- Type errors from Hindley-Milner-style inference (annotations optional)
- Non-exhaustive
match— checked across nine pattern forms, including the cases that trip people up: a guard does not make an arm a catch-all, and an or-pattern containing a wildcard is exhaustive.
The same checks run in your editor via lux-lsp and in the browser via
the playground — same parser, same verdicts.
Tests live next to the code
fn double(x: int) -> int:
x * 2
test "double works":
assert(double(5) == 10)
lux test discovers and runs every test block. No test-runner dependency.