Skip to content

Doc.Policy.CodeFormatting

Joe Latessa edited this page Mar 6, 2026 · 1 revision

Code Formatting

Wiki Page Content Adapted from SMASH

All C++ code is to be formatted by running clang-format, (version 14.0) while CMake code requires cmake-format (version 0.6.13) to be run. These two programs automatically format the code in JETSCAPE correctly. Use the helper script in JETSCAPE's bin directory to format the source code via

./codebase-format-helper.bash C++ -p
./codebase-format-helper.bash CMake -p

or by simply using

./codebase-format-helper.bash -p

to format all languages at once. Review and commit changes afterwards. You can also use the -t option to test whether the code is correctly formatted (the script also has a -h option that you can check out). Ifclang-format makes changes that don't look good, you can disable it locally using comments like this:

// clang-format off
...
// clang-format on

A GitHub Actions test will run on pull requests to the main and release candidate branches to validate the format of proposed code changes.

Clone this wiki locally