-
Notifications
You must be signed in to change notification settings - Fork 423
Code style checking
Yossi Itigin edited this page Dec 7, 2020
·
19 revisions
We use clang-format for automatic check of commit compliance with our code style.
clang >=11
and git-clang-format
are required to run the check.
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 which 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