clang-format is a tool that can be used to format C++ code to match a coding style.
$ sudo apt install clang-format
$ clang-format foobar.cpp
This formats the lines in the input file and spits out the formatted lines to stdout.
$ clang-format -i foobar.cpp
.clang-format
config file in one of the parent dirs of source file:$ clang-format -style=file foobar.cpp