BoxLang Syntax Check
Validate BoxLang and CFML source files for syntax errors without executing them.
The BoxLang Syntax Check tool (check) is a CLI action command that parses one or more source files and reports syntax errors, without executing the code or compiling it to bytecode. It's the BoxLang equivalent of bash -n script.sh or node --check file.js — a fast way to validate that your code is well-formed before you run it, commit it, or ship it.
This makes it a great fit for:
Pre-commit and git hooks
CI pipelines, as a fast fail-early step before running the full test suite
Editor/IDE tooling integrations (via
--format json)
Like the other BoxLang CLI tools, syntax checking is based on our BL AST (BoxLang Abstract Syntax Tree) and the actual BL ANTLR parsers, so results are accurate for both BoxLang and CFML source.
Usage
Make sure you have installed the OS version of BoxLang so you get all the tools installed as well. Please note that the action command funnels through the boxlang binary, so you can use all the CLI arguments for the boxlang runner.
// Using the script
boxlang check [OPTIONS] [FILE...]
// Using the full path to the jar
java -cp boxlang-1.0.0.jar ortus.boxlang.compiler.SyntaxCheck [OPTIONS] [FILE...]You can pass one or more explicit file paths, a --source directory to scan recursively, or both.
Supported Source Files
.cfm .cfc .cfs .bx .bxs .bxm
CLI Options
-h, --help- Show the help message and exit.--source <PATH>- Path to a source directory or file to check. When a directory is given, it is walked recursively and every supported file extension is checked.--format <text|json>- Output format. Defaults totext. Usejsonfor machine-readable output suited to editor/CI tooling integration.-q, --quiet- Suppress the per-file success output and summary line. Failures are always reported, even in quiet mode.
You can also pass one or more file paths directly as positional arguments, instead of (or in addition to) --source.
Exit Codes
0- Every checked file is syntactically valid.1- One or more files have syntax errors, or a usage error occurred (e.g. a missing--sourcepath).
Examples
Check one or more specific files:
Check an entire directory recursively, e.g. in CI or a git hook:
Get machine-readable output for editor/CI tooling:
Sample Output
A valid file produces minimal output and exits 0:
An invalid file reports the file, line, column, and message, and exits 1:
Checking a directory reports every file that was scanned, with a combined summary:
--format json returns an array of {file, valid, issues} records, one per checked file:
Last updated
Was this helpful?
