v0.13.2Control flow and dataflow are rebuilt on explicit semantics, Z3 translation matches executable C# numeric rules, and the build chain is hermetic and supply-chain verified with hash- and size-pinned Z3 binaries.See what's new

format

Format Calor source files to canonical style.

Bash
calor format <files...> [options]

Overview

The format command formats Calor source files according to the canonical Calor style guide. This ensures consistent formatting across your codebase.


Quick Start

Bash
# Format a single file (output to stdout)
calor format MyModule.calr

# Format and overwrite the file (explicitly acknowledge the experimental writer)
calor format MyModule.calr --write --experimental

# Check if files are formatted (for CI)
calor format src/*.calr --check

# Show diff of changes
calor format MyModule.calr --diff

Options

OptionShortDefaultDescription
--check-cfalseCheck if files are formatted without modifying (exit 1 if not)
--write-wfalseWrite back; requires --experimental or CALOR_EXPERIMENTAL_FORMAT_WRITE=1
--diff-dfalseShow diff of formatting changes
--verbose-vfalseEnable verbose output
--healfalseBest-effort source repair; review every reported control-flow guess
--formattexttext or schema 2.0 json; no -f alias
--experimentalfalseAcknowledge known formatter write defects

v0.12 release policy: the write path can rewrite identifiers and drop comments. format --write is refused with Calor1346 unless you pass --experimental or set CALOR_EXPERIMENTAL_FORMAT_WRITE=1. Read-only stdout, --check, and --diff remain available without acknowledgment.


Formatting Rules

The Calor formatter applies these rules:

  • 2 spaces per indentation level
  • Single space after structure tags
  • Single space around operators in expressions
  • No trailing whitespace
  • One blank line between functions
  • Newline at end of file

Check Mode

Use --check in CI/CD to verify formatting:

Bash
calor format src/*.calr --check

Exit codes:

  • 0 - All files are formatted correctly
  • 1 - One or more files need formatting

Exit Codes

CodeMeaning
0Success
1Unformatted files found (--check mode)
2Error processing files

See Also