Add .clang-format file
There are currently no pipelines.
To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines and you must have sufficient permissions in the source project.
I propose to add a clang-format configuration file, notably since it allows to configure a range of lines of a file instead of the whole file only. Documentation of the options: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Integration into various editors (vim, emacs, VSCode, CLion) is on the project page: https://clang.llvm.org/docs/ClangFormat.html
There is an eclipse plugin: https://github.com/wangzw/CppStyle
See here for a more detailed explanation. In short: Add this to ~/.gitconfig
:
[clangFormat]
binary = clang-format-12
style = file
Now stage files for reformatting, then run git clang-format
. It will reformat only the code that is staged, and you can the view what with a git diff
(thus, the modified lines are not automatically staged).
There is also a pre-commit hook that you can install in file pre-commit-clang
. See the file for instructions of how to use.
AlignConsecutiveAssignments
set to true. Example:int aaaa = 12;
int b = 23;
int ccc = 23;
BreakBeforeBinaryOperators
if (thisVariable1 == thatVariable1 ||
thisVariable2 == thatVariable2 ||
thisVariable3 == thatVariable3)
bar();
vs.
if (thisVariable1 == thatVariable1
|| thisVariable2 == thatVariable2
|| thisVariable3 == thatVariable3)
bar();
To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines and you must have sufficient permissions in the source project.