midad check

midad check <file.md|dir> [--json]

Type-checks a program, lints it, audits the permissions it asks for and checks the shape of the project. It runs nothing.

$ midad check hello.md
hello.md: ok

A directory with a midad.toml checks from its entry file:

$ midad check .

What it checks

  • Types and names: every expression, every call, every return path.
  • Permissions: a call whose target is not granted is E0300, a route without listen is E0303, persist without both file grants is E0304, static: without an fs_read grant that covers the directory it serves is E0305.
  • Structure: a route outside routes/, a file under routes/ with no route, two files with one module name.
  • Imports: cycles, missing files, aliases, and blocks that would be dropped.
  • Lints: naming, / where integer division looks intended, an unused fn-parameter function.

Warnings are printed and do not change the exit code.

--json

$ midad check hello.md --json

prints one object with ok, command, files, diagnostics and summary. Every diagnostic has all ten fields, with null where a field does not apply. The shape is documented in errors and diagnostics.

Exit codes

0 for no errors, 1 for at least one error, 2 when the command itself was wrong. --json changes what is printed, not the exit code.

On this page