/

Ambitwin · source-available, not open source · © 2026 Nicolò Ghignatti

Linting & Formatting

Keywords on this page
WordMeaningExample
LinterA tool that reads code and reports likely mistakes, without running itclippy warns about a needless clone()
FormatterA tool that rewrites spacing and line breaks into one fixed stylegofmt -w .
Type checkerA tool that checks types in a language that does not force thempyright, vue-tsc
TaskA named command moon knows how to run for a projecttelemetry:lint
AffectedA project whose files changed on the current branchOnly telemetry after a change in backend/telemetry/src
Cache hitmoon skips a task because its inputs did not change since the last passtelemetry:lint in 0 s
Flat configESLint’s config format: one exported list of rule blockstooling/eslint-config/index.mjs

Every language has a linter and a formatter. just lint runs them through moon; CI runs them through one workflow template per language. This page says what runs, where it is configured, and where local and CI differ.


What runs, per language

LanguageProjectsLint (just lint)Fix (just lint fix)CI template
Rust6 services, 4 *-schema cratescargo clippy -- -D warningsnothingtpl-rust-ci.yml: cargo fmt --check, then cargo clippy --release --all-targets -- -D warnings
Go4 services, 3 backend/libs modulesgofmt -l . must print nothing, then go vet ./...nothingtpl-go-ci.yml: same two checks
Python, agentbackend/agentnpm run lint: ruff check, ruff format --check, pyrightruff check --fix, ruff formattpl-python-ci.yml: same three
Python, collectordevices/ap-collectoruv run of ruff check, ruff format --check, pyrightruff check --fix, ruff formattpl-python-ci.yml
Python, simulatorsap-simulator, aq-simulatoruv run ruff check . && uv run pyright, no format checkruff check --fix, ruff formatci-simulators.yml: same two
TypeScript, frontendfrontendeslint .eslint . --fix --cacheci-frontend.yml: npm run lint, npm run type-check
TypeScript, Nodesensor-simulatoreslint .prettier --write, then eslint . --fixci-simulators.yml

just lint affected, end to end

sequenceDiagram
    autonumber
    participant D as Developer
    participant J as just<br/>just/lint.just
    participant W as check-workflow-registry.py
    participant M as moon
    participant P as one project task
    D->>J: just lint affected
    J->>W: recipe workflows runs first
    W-->>J: services.json and workflows agree
    J->>M: mise exec -- moon run :lint --affected
    M->>M: git diff against the base branch
    M->>M: keep projects whose files changed
    loop each affected project
        M->>M: hash the task inputs
        alt same hash as last pass
            M-->>D: cache hit, skipped
        else inputs changed
            M->>P: run lint in the project folder
            P-->>M: exit code
        end
    end
    M-->>D: summary, non-zero if one failed
StepWhat happensReal value
1lint.just declares affected: workflows, so workflows runs first
2Runs with CI’s pinned pyyaml from .github/requirements-lint.txtuv run --no-project --with-requirements …
3A workflow with a dangling needs: fails here, not in a 0 s GitHub run with no logs
4mise exec puts the pinned tools on PATHmoon 2.6.4
5–6Only projects with a changed file staychange in backend/telemetry/src/kernel/ingest.rs keeps telemetry
7Inputs for a Rust lint: src/**/*, Cargo.tomlfrom .moon/tasks/rust.yml
9Rust projectcargo clippy -- -D warnings in backend/telemetry

Example. A branch changes one file in backend/telemetry and one in frontend/src. moon runs telemetry:lint and frontend:lint. No other project runs. Run again with no change: both are cache hits.

flowchart TD
    A["just lint all or affected"] --> B{"workflows check passes?"}
    B -- no --> X["stop, list the dangling needs or uses"]
    B -- yes --> C{"affected only?"}
    C -- yes --> D["projects with changed files"]
    C -- no --> E["every project"]
    D --> F{"inputs hash seen before?"}
    E --> F
    F -- yes --> G["skip, cache hit"]
    F -- no --> H["run the task"]

just lint fix runs moon run :lint-fix with caching off: a fix rewrites files, so a cached “nothing to do” would be wrong.


Rust: clippy and rustfmt

Local moon run :lintCI tpl-rust-ci.yml
Formattingnot checkedcargo fmt --check
Targetslibrary and binaries--all-targets: tests and examples too
Profiledebug--release

Trap. just lint passes on code that CI refuses for two reasons:

  1. A file rustfmt would change. Run cargo fmt in the crate before pushing.
  2. A clippy warning inside tests/. Run cargo clippy --all-targets -- -D warnings to see it.

just lint fix does nothing for Rust: no Rust project defines lint-fix.


Go: gofmt and go vet

The lint task, from .moon/tasks/go.yml:

  1. gofmt -l . lists unformatted files. It exits 0 even when it lists some, so the task wraps it in test -z: a non-empty list fails.
  2. On failure it prints the files and the fix, gofmt -w ..
  3. Then go vet ./..., which finds suspicious code: a wrong Printf verb, an unreachable line, a copied lock.

tpl-go-ci.yml runs the same two checks, and prints each unformatted file as a GitHub annotation on the file. just lint fix does nothing for Go: no Go project defines lint-fix.


Python: ruff and pyright

Config lives in each pyproject.toml. For agent:

SettingValueWhy
line-length100
Rule familiesE W F I B UP N S ASYNC SIM PTH TID TCH RUF C4 PIE RETErrors, imports order, likely bugs, security (S), async misuse
IgnoredE501, B008, S101The formatter owns line length; FastAPI Depends() in defaults; assert
Per foldertests/** and evals/** skip S; alembic/** skips NTest fixtures look like secrets; migration names are generated
ruff formatdouble quotes, spaces
pyrightbasic mode, on app and testsA missing import is an error; an unused one is a warning

Trap. The inherited Python lint task calls npm run lint. Only agent has a package.json wrapping uv; the root .gitignore ignores every other package.json. So the simulators and the collector override lint to call uv directly, and backend/acceptance turns it off. A new Python project that does neither fails with “missing script”.


TypeScript: ESLint, Prettier, vue-tsc

Two configs:

ConfigUsed byContent
tooling/eslint-config/index.mjs, package @ambitwin/eslint-configsensor-simulator, via a one-line eslint.config.mjs@eslint/js recommended, typescript-eslint recommended, Node and Jest globals, eslint-config-prettier last
frontend/eslint.config.tsfrontendeslint-plugin-vue flat/essential, Vue TypeScript recommended, Vitest rules on src/**/__tests__/*, Playwright rules on e2e/**, skip-formatting last

Workflows

just lint workflows runs scripts/check-workflow-registry.py. It checks .github/workflows/*.yml against .github/services.json, and reports any needs: or uses: that points at nothing. ci-gate.yml runs the same script in its workflows-lint job.


Choices

ChoiceWhy
One pin per tool, in .mise.tomlA new compiler warns about new things; local and CI must agree
-D warningsA warning ignored once is ignored forever
Lint through moonOnly changed projects run, and an unchanged one is free
Formatter config last in ESLintTwo tools never argue about the same space

See also: Build System, CI.