Format JCM Files

Use the jcmsuite-format command to format JCMsuite source files. The command supports JCM input files and template files with the .jcm, .jcmp, .jcmt, and .jcmpt extensions.

Write Formatted Files

Pass one or more files or directories. The command writes formatted files:

jcmsuite-format project.jcmp templates/

Check Formatting

Use --check to check files without changing them. The command reports each file that needs formatting and returns a non-zero status when it finds one:

jcmsuite-format --check project.jcmp

Formatting Rules

The formatter applies these changes to JCM source:

  • It sets indentation from the JCM brace nesting.

  • It expands inline brace blocks into nested lines.

  • It puts consecutive assignment statements on separate lines.

  • It adds spaces around assignment operators.

  • It adds spaces after commas.

  • It keeps blank lines and the file newline convention.

The formatter preserves strings, comments, project key substitutions, and Python blocks in template files. It rejects unbalanced braces, unterminated strings, and invalid template boundaries. It does not guess how to repair malformed source.

The Python function raises ValueError for these invalid inputs. The command reports the error on standard error and returns status 2.