Skip to content

Code style checking

Yossi Itigin edited this page Jun 30, 2021 · 19 revisions

We use clang-format for automatic check of commit compliance with our code style.

Since upstream clang does not support all UCX style guidelines, we forked clang in https://github.com/openucx/llvm-project and added specific tweaks to it. The fork is based on clang 11.

git-clang-format must be run in the root directory of the repository - the style rules are defined in .clang-format file which is located there.

Invoking git-clang-format will check and fix files that were changed between HEAD and the working directory (only the modified lines are affected by formatting - git-clang-format doesn't check pre-existing code).

It is also possible to run the check on a particular commits diff, see git-clang-format -h for options.

Currently, the code style check is experimental and is recommended to be performed locally by each contributor when opening a PR

Example usage:

module load dev/gcc-latest
module load dev/clang-latest
git-clang-format --diff HEAD^^ HEAD
Clone this wiki locally