Skip to main content

zith check

The check command analyzes your code for errors without generating a binary. Perfect for quick feedback during development.

Usage

zith check [options] [file|project]

Examples

Check Current Project

# Check entire project from root directory
zith check

Check Specific File

# Check a single file
zith check src/main.zith

# Check with line numbers
zith check --verbose src/module.zith

Check All Files in Directory

# Recursively check all .zith files
zith check ./src/

Options

FlagDescription
--verbose, -vShow detailed error information
--warnings-as-errorsTreat warnings as errors
--no-colorDisable colored output
--jsonOutput errors in JSON format
--quiet, -qOnly show errors, no warnings

Output Format

Default Output

Checking src/main.zith...
error[E001]: Type mismatch
--> src/main.zith:15:8
|
15 | let x: i32 = "hello";
| ^^^ ^^^^^^ expected i32, found str
|
= help: Change type to 'str' or value to an integer

JSON Output

zith check --json
{
"file": "src/main.zith",
"line": 15,
"column": 8,
"level": "error",
"code": "E001",
"message": "Type mismatch",
"help": "Change type to 'str' or value to an integer"
}

Exit Codes

  • 0 - No errors found
  • 1 - Errors found
  • 2 - Fatal error (file not found, etc.)

Common Error Codes

CodeDescription
E001Type mismatch
E002Undefined variable
E003Duplicate definition
E004Missing return statement
E005Invalid ownership modifier
W001Unused variable (warning)
W002Unreachable code (warning)

Integration with Editors

Use --json flag for editor integration:

# VS Code task example
{
"label": "Zith Check",
"type": "shell",
"command": "zith check --json",
"problemMatcher": {
"owner": "zith",
"pattern": {
"file": "${file}",
"line": "${line}",
"message": "${message}"
}
}
}

Tips

  • Run zith check before committing to catch errors early
  • Use --warnings-as-errors in CI/CD pipelines
  • Combine with zith fmt for clean, error-free code

See Also